From 64be7a414db50ad61d6c1488ce481a5a6d1f4515 Mon Sep 17 00:00:00 2001 From: jamesmcnamara Date: Wed, 9 Oct 2024 16:44:24 -0700 Subject: [PATCH 01/10] refactored code generation and added special case for auth status --- .../agent/protocol_generated/AuthStatus.kt | 17 +- .../protocol_generated/CodyAgentServer.kt | 2 + .../CodyLLMSiteConfiguration.kt | 14 - .../agent/protocol_generated/Constants.kt | 1 - ...estoreParams.kt => OrganizationsParams.kt} | 7 +- .../SerializedChatMessage.kt | 6 + ...sting_Autocomplete_ProviderConfigResult.kt | 9 + agent/src/agent.ts | 2 +- agent/src/cli/scip-codegen/BaseCodegen.ts | 12 +- agent/src/cli/scip-codegen/Codegen.ts | 929 +++++------------- agent/src/cli/scip-codegen/Formatter.ts | 158 +-- .../scip-codegen/emitters/CSharpEmitter.ts | 295 ++++++ .../src/cli/scip-codegen/emitters/Emitter.ts | 84 ++ .../cli/scip-codegen/emitters/JavaEmitter.ts | 306 ++++++ .../scip-codegen/emitters/KotlinEmitter.ts | 276 ++++++ agent/src/cli/scip-codegen/utils.ts | 29 +- agent/src/enterprise-s2.test.ts | 7 +- lib/shared/src/auth/types.ts | 8 +- vscode/src/jsonrpc/agent-protocol.ts | 6 +- 19 files changed, 1292 insertions(+), 876 deletions(-) delete mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/CodyLLMSiteConfiguration.kt rename agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/{Chat_RestoreParams.kt => OrganizationsParams.kt} (53%) create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/Testing_Autocomplete_ProviderConfigResult.kt create mode 100644 agent/src/cli/scip-codegen/emitters/CSharpEmitter.ts create mode 100644 agent/src/cli/scip-codegen/emitters/Emitter.ts create mode 100644 agent/src/cli/scip-codegen/emitters/JavaEmitter.ts create mode 100644 agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/AuthStatus.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/AuthStatus.kt index 62476234c0be..41821594f443 100644 --- a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/AuthStatus.kt +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/AuthStatus.kt @@ -1,7 +1,6 @@ @file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport") package com.sourcegraph.cody.agent.protocol_generated; -import com.google.gson.annotations.SerializedName; import com.google.gson.Gson; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; @@ -12,11 +11,10 @@ sealed class AuthStatus { companion object { val deserializer: JsonDeserializer = JsonDeserializer { element: JsonElement, _: Type, context: JsonDeserializationContext -> - if (element.getAsJsonObject().get("username") == null) { - context.deserialize(element, UnauthenticatedAuthStatus::class.java) - } else { - context.deserialize(element, AuthenticatedAuthStatus::class.java) - } + when (element.getAsJsonObject().get("authenticated").getAsBoolean()) { + false -> context.deserialize(element, UnauthenticatedAuthStatus::class.java) + true -> context.deserialize(element, AuthenticatedAuthStatus::class.java) + } } } } @@ -27,8 +25,7 @@ data class UnauthenticatedAuthStatus( val showNetworkError: Boolean? = null, val showInvalidAccessTokenError: Boolean? = null, val pendingValidation: Boolean, -) : AuthStatus() { -} +) : AuthStatus() data class AuthenticatedAuthStatus( val endpoint: String, @@ -41,6 +38,6 @@ data class AuthenticatedAuthStatus( val displayName: String? = null, val avatarURL: String? = null, val pendingValidation: Boolean, -) : AuthStatus() { -} + val organizations: List? = null, +) : AuthStatus() diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/CodyAgentServer.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/CodyAgentServer.kt index b8140ed8af07..ae225c5f1695 100644 --- a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/CodyAgentServer.kt +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/CodyAgentServer.kt @@ -120,6 +120,8 @@ interface CodyAgentServer { fun testing_autocomplete_awaitPendingVisibilityTimeout(params: Null?): CompletableFuture @JsonRequest("testing/autocomplete/setCompletionVisibilityDelay") fun testing_autocomplete_setCompletionVisibilityDelay(params: Testing_Autocomplete_SetCompletionVisibilityDelayParams): CompletableFuture + @JsonRequest("testing/autocomplete/providerConfig") + fun testing_autocomplete_providerConfig(params: Null?): CompletableFuture @JsonRequest("extensionConfiguration/change") fun extensionConfiguration_change(params: ExtensionConfiguration): CompletableFuture @JsonRequest("extensionConfiguration/status") diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/CodyLLMSiteConfiguration.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/CodyLLMSiteConfiguration.kt deleted file mode 100644 index 022766952071..000000000000 --- a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/CodyLLMSiteConfiguration.kt +++ /dev/null @@ -1,14 +0,0 @@ -@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport") -package com.sourcegraph.cody.agent.protocol_generated; - -data class CodyLLMSiteConfiguration( - val chatModel: String? = null, - val chatModelMaxTokens: Long? = null, - val fastChatModel: String? = null, - val fastChatModelMaxTokens: Long? = null, - val completionModel: String? = null, - val completionModelMaxTokens: Long? = null, - val provider: String? = null, - val smartContextWindow: Boolean? = null, -) - diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/Constants.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/Constants.kt index 105da2e2c31e..c907b6490d17 100644 --- a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/Constants.kt +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/Constants.kt @@ -41,7 +41,6 @@ object Constants { const val function = "function" const val gateway = "gateway" const val history = "history" - const val `https-example-com` = "https://example.com" const val human = "human" const val ignore = "ignore" const val indentation = "indentation" diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/Chat_RestoreParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/OrganizationsParams.kt similarity index 53% rename from agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/Chat_RestoreParams.kt rename to agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/OrganizationsParams.kt index 671e79f878e9..eb6e2500cc5e 100644 --- a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/Chat_RestoreParams.kt +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/OrganizationsParams.kt @@ -1,9 +1,8 @@ @file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport") package com.sourcegraph.cody.agent.protocol_generated; -data class Chat_RestoreParams( - val modelID: String? = null, - val messages: List, - val chatID: String, +data class OrganizationsParams( + val name: String, + val id: String, ) diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/SerializedChatMessage.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/SerializedChatMessage.kt index 87f8b72cb1db..9e193acca994 100644 --- a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/SerializedChatMessage.kt +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/SerializedChatMessage.kt @@ -10,6 +10,7 @@ data class SerializedChatMessage( val speaker: SpeakerEnum, // Oneof: human, assistant, system val text: String? = null, val model: String? = null, + val intent: IntentEnum? = null, // Oneof: search, chat ) { enum class SpeakerEnum { @@ -17,5 +18,10 @@ data class SerializedChatMessage( @SerializedName("assistant") Assistant, @SerializedName("system") System, } + + enum class IntentEnum { + @SerializedName("search") Search, + @SerializedName("chat") Chat, + } } diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/Testing_Autocomplete_ProviderConfigResult.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/Testing_Autocomplete_ProviderConfigResult.kt new file mode 100644 index 000000000000..9d1499d2adb9 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/Testing_Autocomplete_ProviderConfigResult.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport") +package com.sourcegraph.cody.agent.protocol_generated; + +data class Testing_Autocomplete_ProviderConfigResult( + val id: String, + val legacyModel: String, + val configSource: String, +) + diff --git a/agent/src/agent.ts b/agent/src/agent.ts index 788c72f3b080..c488d0a1ede5 100644 --- a/agent/src/agent.ts +++ b/agent/src/agent.ts @@ -994,7 +994,7 @@ export class Agent extends MessageHandler implements ExtensionClient { this.registerAuthenticatedRequest('testing/autocomplete/providerConfig', async () => { const provider = await vscode_shim.completionProvider() - return provider.config + return provider.config.provider }) this.registerAuthenticatedRequest('graphql/getRepoIds', async ({ names, first }) => { diff --git a/agent/src/cli/scip-codegen/BaseCodegen.ts b/agent/src/cli/scip-codegen/BaseCodegen.ts index 245756c01bf4..8a2ff8954498 100644 --- a/agent/src/cli/scip-codegen/BaseCodegen.ts +++ b/agent/src/cli/scip-codegen/BaseCodegen.ts @@ -21,8 +21,18 @@ export interface ProtocolSymbol { kind: ProtocolMethodKind } +export type ConstantType = string | boolean | number +export type ConstantTypeType = 'string' | 'boolean' | 'number' + +export function typeOfUnion(union: DiscriminatedUnion): ConstantTypeType { + if (union.members.length === 0) { + throw new TypeError(`Union ${JSON.stringify(union, null, 2)} has no members`) + } + return typeof union.members[0].value as ConstantTypeType +} + export interface DiscriminatedUnionMember { - value: string + value: ConstantType type: scip.Type } export interface DiscriminatedUnion { diff --git a/agent/src/cli/scip-codegen/Codegen.ts b/agent/src/cli/scip-codegen/Codegen.ts index eacd17c3e665..41916c93b410 100644 --- a/agent/src/cli/scip-codegen/Codegen.ts +++ b/agent/src/cli/scip-codegen/Codegen.ts @@ -1,14 +1,23 @@ import fspromises from 'node:fs/promises' import path from 'node:path' import dedent from 'dedent' -import { BaseCodegen, type DiscriminatedUnion, type DiscriminatedUnionMember } from './BaseCodegen' +import { + BaseCodegen, + type ConstantType, + type DiscriminatedUnion, + type DiscriminatedUnionMember, +} from './BaseCodegen' import { CodePrinter } from '../../../../vscode/src/completions/context/retrievers/tsc/CodePrinter' import type { ConsoleReporter } from './ConsoleReporter' import { type Diagnostic, Severity } from './Diagnostic' -import { Formatter } from './Formatter' +import type { Formatter } from './Formatter' import type { SymbolTable } from './SymbolTable' import type { CodegenOptions } from './command' +import { CSharpEmitter } from './emitters/CSharpEmitter' +import type { DataClassOptions, Emitter, Enum, Member } from './emitters/Emitter' +import { JavaEmitter } from './emitters/JavaEmitter' +import { KotlinEmitter } from './emitters/KotlinEmitter' import { resetOutputPath } from './resetOutputPath' import { scip } from './scip' import { stringLiteralType } from './stringLiteralType' @@ -25,21 +34,31 @@ export enum TargetLanguage { Kotlin = 'kotlin', CSharp = 'csharp', } - export class Codegen extends BaseCodegen { - private f: Formatter public queue: scip.SymbolInformation[] = [] public generatedSymbols = new Set() public stringLiteralConstants = new Set() + private emitter: Emitter constructor( - private language: TargetLanguage, + language: TargetLanguage, options: CodegenOptions, symtab: SymbolTable, reporter: ConsoleReporter ) { super(options, symtab, reporter) - this.f = new Formatter(this.language, this.symtab, this) + this.emitter = this.getEmitter(language) + } + + private getEmitter(language: TargetLanguage): Emitter { + switch (language) { + case TargetLanguage.Kotlin: + return new KotlinEmitter(this.options, this.symtab, this) + case TargetLanguage.Java: + return new JavaEmitter(this.options, this.symtab, this) + case TargetLanguage.CSharp: + return new CSharpEmitter(this.options, this.symtab, this) + } } public async run(): Promise { @@ -56,9 +75,9 @@ export class Codegen extends BaseCodegen { BaseCodegen.protocolSymbols.server.notifications ) let info = this.queue.pop() - while (info !== undefined) { + while (info) { if (!this.generatedSymbols.has(info.symbol)) { - this.writeType(info) + await this.writeType(info) this.generatedSymbols.add(info.symbol) } info = this.queue.pop() @@ -73,7 +92,11 @@ export class Codegen extends BaseCodegen { private startDocument(): DocumentContext & { c: DocumentContext } { - const context: DocumentContext = { f: this.f, p: new CodePrinter(), symtab: this.symtab } + const context: DocumentContext = { + f: this.emitter.formatter, + p: new CodePrinter(), + symtab: this.symtab, + } return { ...context, c: context } } @@ -82,62 +105,13 @@ export class Codegen extends BaseCodegen { return } const { p } = this.startDocument() - switch (this.language) { - case TargetLanguage.Kotlin: - p.line('@file:Suppress("unused", "ConstPropertyName")') - p.line(`package ${this.options.kotlinPackage};`) - p.line() - p.line('object ProtocolTypeAdapters {') - break - case TargetLanguage.Java: - p.line(`package ${this.options.kotlinPackage};`) - p.line() - p.line('public final class ProtocolTypeAdapters {') - break - case TargetLanguage.CSharp: - p.line(`namespace ${this.options.kotlinPackage};`) - p.line('{') - p.block(() => { - p.line('public static class ProtocolTypeAdapters') - p.line('{') - }) - break - } - p.block(() => { - switch (this.language) { - case TargetLanguage.Kotlin: - p.line('fun register(gson: com.google.gson.GsonBuilder) {') - break - case TargetLanguage.Java: - p.line('public static void register(com.google.gson.GsonBuilder gson) {') - break - case TargetLanguage.CSharp: - p.line('public static void Register(JsonSerializerOptions options)') - p.line('{') - break - } - p.block(() => { - const discriminatedUnions = [...this.discriminatedUnions.keys()].sort() - for (const symbol of discriminatedUnions) { - const name = this.symtab.info(symbol).display_name - switch (this.language) { - case TargetLanguage.Kotlin: - p.line(`gson.registerTypeAdapter(${name}::class.java, ${name}.deserializer)`) - break - case TargetLanguage.Java: - p.line(`gson.registerTypeAdapter(${name}.class, ${name}.deserializer());`) - break - case TargetLanguage.CSharp: - p.line(`options.Converters.Add(new ${name}Converter());`) - break - } - } - }) - p.line('}') - }) - p.line('}') + + const discriminatedUnions = [...this.discriminatedUnions.keys()] + .sort() + .map(symbol => this.symtab.info(symbol).display_name) + this.emitter.emitSerializationAdapter(p, discriminatedUnions) await fspromises.writeFile( - path.join(this.options.output, `ProtocolTypeAdapters.${this.fileExtension()}`), + path.join(this.options.output, `ProtocolTypeAdapters.${this.emitter.getFileType()}`), p.build() ) } @@ -147,92 +121,19 @@ export class Codegen extends BaseCodegen { return } const { p } = this.startDocument() - switch (this.language) { - case TargetLanguage.CSharp: - p.line(`namespace ${this.options.kotlinPackage};`) - p.line('{') - p.line('public static class Constants') - p.line('{') - break - case TargetLanguage.Kotlin: - p.line('@file:Suppress("unused", "ConstPropertyName")') - p.line(`package ${this.options.kotlinPackage};`) - p.line() - p.line('object Constants {') - break - case TargetLanguage.Java: - p.line(`package ${this.options.kotlinPackage};`) - p.line() - p.line('public final class Constants {') - break - } - p.block(() => { - const constants = [...this.stringLiteralConstants.values()].sort() - for (const constant of constants) { - switch (this.language) { - case TargetLanguage.Kotlin: - p.line(`const val ${this.f.formatFieldName(constant)} = "${constant}"`) - break - case TargetLanguage.Java: - p.line( - `public static final String ${this.f.formatFieldName( - constant - )} = "${constant}";` - ) - break - case TargetLanguage.CSharp: - p.line( - `public const string ${this.f.formatFieldName(constant)} = "${constant}";` - ) - break - } - } - }) - p.line('}') - if (this.language === TargetLanguage.CSharp) { - p.line('}') - } + const constants = [...this.stringLiteralConstants.values()].sort() + this.emitter.emitStringLiteralConstants(p, constants) await fspromises.writeFile( - path.join(this.options.output, `Constants.${this.fileExtension()}`), + path.join(this.options.output, `Constants.${this.emitter.getFileType()}`), p.build() ) } - private fileExtension() { - switch (this.language) { - case TargetLanguage.CSharp: - return 'cs' - case TargetLanguage.Kotlin: - return 'kt' - default: - return 'java' - } - } - private async writeNullAlias(): Promise { const { p } = this.startDocument() - switch (this.language) { - case TargetLanguage.Kotlin: - p.line(`package ${this.options.kotlinPackage};`) - p.line() - p.line('typealias Null = Void?') - break - case TargetLanguage.Java: - p.line(`package ${this.options.kotlinPackage};`) - p.line() - p.line('public final class Null {}') - break - case TargetLanguage.CSharp: - p.line(`namespace ${this.options.kotlinPackage};`) - p.line('{') - p.block(() => { - p.line('public sealed class Null {}') - }) - p.line('}') - break - } + this.emitter.emitNullAlias(p) await fspromises.writeFile( - path.join(this.options.output, `Null.${this.fileExtension()}`), + path.join(this.options.output, `Null.${this.emitter.getFileType()}`), p.build() ) } @@ -241,170 +142,24 @@ export class Codegen extends BaseCodegen { { p, f, symtab }: DocumentContext, name: string, info: scip.SymbolInformation, - union: DiscriminatedUnion + { members, ...unionArgs }: DiscriminatedUnion ): Promise { - if (this.language === TargetLanguage.CSharp) { - p.addImport('using Newtonsoft.Json;') - } else { - p.line('import com.google.gson.Gson;') - p.line('import com.google.gson.JsonDeserializationContext;') - p.line('import com.google.gson.JsonDeserializer;') - p.line('import com.google.gson.JsonElement;') - p.line('import java.lang.reflect.Type;') - } - p.line() - switch (this.language) { - case TargetLanguage.Kotlin: - p.line(`sealed class ${name} {`) - break - case TargetLanguage.Java: - p.line(`public abstract class ${name} {`) - break - case TargetLanguage.CSharp: - p.line(`[JsonConverter(typeof(${name}Converter))]`) - name = name - .split(/[ -]/) - .map(part => part.charAt(0).toUpperCase() + part.slice(1)) - .join('') - p.line(`public abstract class ${name}`) - p.line('{') - break - } - p.block(() => { - if (this.language === TargetLanguage.Kotlin) { - p.line('companion object {') + const isHandledCase = new Set() + const union: DiscriminatedUnion = { ...unionArgs, members: [] } + for (const member of members) { + if (isHandledCase.has(member.value)) { + // There's a bug in ContextProvider where + // two cases have the same discriminator + // 'search' + this.reporter.warn(info.symbol, `duplicate discriminator value ${member.value}`) + continue } - p.block(() => { - switch (this.language) { - case TargetLanguage.Kotlin: - p.line(`val deserializer: JsonDeserializer<${name}> =`) - break - case TargetLanguage.Java: - p.line(`public static JsonDeserializer<${name}> deserializer() {`) - break - case TargetLanguage.CSharp: - p.line(`private class ${name}Converter : JsonConverter<${name}>`) - p.line('{') - p.block(() => { - p.line( - `public override ${name} Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)` - ) - p.line('{') - p.block(() => { - p.line('var jsonDoc = JsonDocument.ParseValue(ref reader);') - p.line( - `var discriminator = jsonDoc.RootElement.GetProperty("${union.discriminatorDisplayName}").GetString();` - ) - p.line('switch (discriminator)') - p.line('{') - }) - }) - break - } - p.block(() => { - switch (this.language) { - case TargetLanguage.Kotlin: - p.line( - 'JsonDeserializer { element: JsonElement, _: Type, context: JsonDeserializationContext ->' - ) - break - case TargetLanguage.Java: - p.line('return (element, _type, context) -> {') - break - } - p.block(() => { - const keyword = this.language === TargetLanguage.Kotlin ? 'when' : 'switch' - if (this.language !== TargetLanguage.CSharp) { - p.line( - `${keyword} (element.getAsJsonObject().get("${union.discriminatorDisplayName}").getAsString()) {` - ) - } - p.block(() => { - const isHandledCase = new Set() - for (const member of union.members) { - if (isHandledCase.has(member.value)) { - // There's a bug in ContextProvider where - // two cases have the same discriminator - // 'search' - this.reporter.warn( - info.symbol, - `duplicate discriminator value ${member.value}` - ) - continue - } - isHandledCase.add(member.value) - const typeName = this.f.discriminatedUnionTypeName(union, member) - switch (this.language) { - case TargetLanguage.Kotlin: - p.line( - `"${member.value}" -> context.deserialize<${typeName}>(element, ${typeName}::class.java)` - ) - break - case TargetLanguage.Java: - p.line( - `case "${member.value}": return context.deserialize(element, ${typeName}.class);` - ) - break - case TargetLanguage.CSharp: - p.line(`case "${member.value}":`) - p.block(() => { - p.line( - `return JsonSerializer.Deserialize<${typeName}>(jsonDoc.RootElement.GetRawText(), options);` - ) - }) - break - } - } - switch (this.language) { - case TargetLanguage.Kotlin: - p.line('else -> throw Exception("Unknown discriminator ${element}")') - break - case TargetLanguage.Java: - p.line( - 'default: throw new RuntimeException("Unknown discriminator " + element);' - ) - break - case TargetLanguage.CSharp: - p.line('default:') - p.block(() => { - p.line( - 'throw new JsonException($"Unknown discriminator {discriminator}");' - ) - }) - p.line('}') - break - } - }) - p.line('}') - }) - switch (this.language) { - case TargetLanguage.CSharp: - p.line( - 'public override void Write(Utf8JsonWriter writer, ${name} value, JsonSerializerOptions options)' - ) - p.line('{') - p.block(() => { - p.line( - 'JsonSerializer.Serialize(writer, value, value.GetType(), options);' - ) - }) - break - case TargetLanguage.Java: - p.line('};') - break - default: - p.line('}') - } - }) - }) - p.line('}') - }) - if (this.language === TargetLanguage.Kotlin || this.language === TargetLanguage.CSharp) { - p.line('}') + isHandledCase.add(member.value) + union.members.push(member) } + this.emitter.startSealedClass(p, { name, info, union }) for (const member of union.members) { - p.line() - const typeName = this.f.discriminatedUnionTypeName(union, member) + const typeName = this.emitter.formatter.discriminatedUnionTypeName(union, member) const info = member.type.has_type_ref ? this.symtab.info(member.type.type_ref.symbol) : new scip.SymbolInformation({ @@ -415,24 +170,17 @@ export class Codegen extends BaseCodegen { }) this.writeDataClass({ p, f, symtab }, typeName, info, { innerClass: true, - heritageClause: - this.language === TargetLanguage.Kotlin - ? ` : ${name}()` - : this.language === TargetLanguage.Java - ? ` extends ${name}` - : ` : ${name}`, + parentClass: name, }) } - if (this.language === TargetLanguage.Java || this.language === TargetLanguage.CSharp) { - p.line('}') - } + this.emitter.closeSealedClass?.(p, { name, info, union }) } private async writeDataClass( { p, f, symtab }: DocumentContext, name: string, info: scip.SymbolInformation, - params?: { heritageClause?: string; innerClass?: boolean } + params?: Partial ): Promise { if (info.kind === scip.SymbolInformation.Kind.Class) { this.reporter.warn( @@ -441,156 +189,91 @@ export class Codegen extends BaseCodegen { ) } const generatedName = new Set() - const enums: { name: string; members: string[] }[] = [] - switch (this.language) { - case TargetLanguage.Kotlin: - p.line(`data class ${name}(`) - break - case TargetLanguage.Java: { - const staticModifier = params?.innerClass ? 'static ' : '' - p.line(`public ${staticModifier}final class ${name}${params?.heritageClause ?? ''} {`) - break + const enums: Enum[] = [] + const members: Member[] = [] + for (const memberSymbol of this.infoProperties(info)) { + if ( + this.emitter.formatter.ignoredProperties.find(ignoredProperty => + memberSymbol.includes(ignoredProperty) + ) + ) { + continue } - case TargetLanguage.CSharp: - p.line(`public class ${name}${params?.heritageClause ?? ''}`) - p.line('{') - break - } - p.block(() => { - let hasMembers = false - for (const memberSymbol of this.infoProperties(info)) { - if ( - this.f.ignoredProperties.find(ignoredProperty => - memberSymbol.includes(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 (generatedName.has(member.display_name)) { - continue - } - generatedName.add(member.display_name) - - 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 (this.f.isIgnoredType(memberType)) { - 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) - let memberTypeSyntax = f.jsonrpcTypeName(member, memberType, 'parameter') - const constants = this.stringConstantsFromInfo(member) - for (const constant of constants) { - // HACK: merge this duplicate code with the same logic in this file - this.stringLiteralConstants.add(constant) - } + if (generatedName.has(member.display_name)) { + continue + } + generatedName.add(member.display_name) - if (constants.length > 0 && memberTypeSyntax.startsWith('String')) { - const enumTypeName = this.f.formatEnumType(member.display_name) - memberTypeSyntax = enumTypeName + this.f.nullableSyntax(memberType) - enums.push({ name: enumTypeName, members: constants }) - } else { - this.queueClassLikeType(memberType, member, 'parameter') - } - const oneofSyntax = constants.length > 0 ? ' // Oneof: ' + constants.join(', ') : '' - const defaultValueSyntax = this.f.isNullable(memberType) ? ' = null' : '' - const fieldName = this.f.formatFieldName(member.display_name) - const serializedAnnotation = - fieldName === member.display_name - ? '' - : `@com.google.gson.annotations.SerializedName("${member.display_name}") ` - switch (this.language) { - case TargetLanguage.Kotlin: - p.line( - `val ${member.display_name}: ${memberTypeSyntax}${defaultValueSyntax},${oneofSyntax}` - ) - break - case TargetLanguage.Java: - p.line( - `${serializedAnnotation}public ${memberTypeSyntax} ${this.f.formatFieldName( - member.display_name - )};${oneofSyntax}` - ) - break - case TargetLanguage.CSharp: - p.line(`[JsonProperty(PropertyName = "${member.display_name}")]`) - if (oneofSyntax.includes('-')) { - p.line( - `public string ${this.f.formatFieldName( - member.display_name - )} { get; set; }${oneofSyntax}` - ) - enums.length = 0 - } else { - p.line( - `public ${memberTypeSyntax} ${this.f.formatFieldName( - member.display_name - )} { get; set; }${oneofSyntax}` - ) - } - break - } - hasMembers = true + if (!member.signature.has_value_signature) { + throw new TypeError( + `not a value signature: ${JSON.stringify(member.toObject(), null, 2)}` + ) } - if (!hasMembers) { - if (this.language === TargetLanguage.Kotlin) { - p.line('val placeholderField: String? = null // Empty data class') - } else if (this.language === TargetLanguage.CSharp) { - p.line('public string PlaceholderField { get; set; } // Empty class') - } + 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 } - }) - if (enums.length === 0) { - if (this.language === TargetLanguage.Kotlin) { - p.line(`)${params?.heritageClause ?? ''}`) - } else { - p.line('}') + const memberType = member.signature.value_signature.tpe + if (memberType === undefined) { + throw new TypeError(`no type: ${JSON.stringify(member.toObject(), null, 2)}`) } - return - } - if (this.language === TargetLanguage.Kotlin) { - p.line(`)${params?.heritageClause ?? ''} {`) - } - // Nest enum classe inside data class to avoid naming conflicts with - // enums for other data classes in the same package. - p.block(() => { - if (this.language === TargetLanguage.Kotlin) { - p.addImport('import com.google.gson.annotations.SerializedName;') - } else if (this.language === TargetLanguage.CSharp) { - p.addImport('using Newtonsoft.Json;') + + if (f.isIgnoredType(memberType)) { + continue + } + + let memberTypeSyntax = f.jsonrpcTypeName(member, memberType, 'parameter') + const constants = this.stringConstantsFromInfo(member) + for (const constant of constants) { + // HACK: merge this duplicate code with the same logic in this file + this.stringLiteralConstants.add(constant) } - for (const { name, members } of enums) { - this.writeEnum(p, name, members) + if (constants.length > 0 && memberTypeSyntax.startsWith('String')) { + const enumTypeName = this.emitter.formatter.formatEnumType(member.display_name) + memberTypeSyntax = enumTypeName + this.emitter.formatter.nullableSyntax(memberType) + enums.push({ + name: enumTypeName, + members: constants.map(constant => ({ + serializedName: constant, + formattedName: this.emitter.formatter.formatFieldName(capitalize(constant)), + })), + }) + } else { + this.queueClassLikeType(memberType, member, 'parameter') } + const oneofSyntax = constants.length > 0 ? ' // Oneof: ' + constants.join(', ') : '' + const fieldName = this.emitter.formatter.formatFieldName(member.display_name) + members.push({ + info: member, + typeSyntax: memberTypeSyntax, + formattedName: fieldName, + oneOfComment: oneofSyntax, + isNullable: this.emitter.formatter.isNullable(memberType), + }) + } + this.emitter.emitDataClass(p, { + ...params, + name, + info, + members, + enums, }) - p.line('}') } private aliasType(info: scip.SymbolInformation): string | undefined { @@ -612,136 +295,33 @@ export class Codegen extends BaseCodegen { return undefined } - private writeEnum(p: CodePrinter, name: string, members: string[]): void { - p.line() - switch (this.language) { - case TargetLanguage.Kotlin: - p.line(`enum class ${name} {`) - break - case TargetLanguage.Java: - p.line(`public enum ${name} {`) - break - case TargetLanguage.CSharp: - p.line(`public enum ${name}`) - p.line('{') - break - } - p.block(() => { - for (const member of members) { - const serializedName = (() => { - switch (this.language) { - case TargetLanguage.CSharp: - return '' - case TargetLanguage.Kotlin: - return `@SerializedName("${member}")` - case TargetLanguage.Java: - return `@com.google.gson.annotations.SerializedName("${member}")` - default: - return '' - } - })() - const enumName = this.f.formatFieldName(capitalize(member)) - switch (this.language) { - case TargetLanguage.CSharp: - p.line(`${enumName}, // ${member}`) - break - default: - p.line(`${serializedName} ${enumName},`) - break - } - } - }) - p.line('}') - } - private async writeType(info: scip.SymbolInformation): Promise { const { f, p, c } = this.startDocument() const name = f.typeName(info) const alias = this.aliasType(info) - - if (this.language === TargetLanguage.CSharp) { - p.addImport('using Newtonsoft.Json;') - p.line() - p.line(`namespace ${this.options.kotlinPackage}`) - p.line('{') - p.block(() => { - if (alias) { - if (this.isStringTypeInfo(info)) { - const constants = this.stringConstantsFromInfo(info) - if (constants.length > 0) { - this.writeEnum(p, name, constants) - } else { - p.line(`public class ${name}`) - p.line('{') - p.block(() => { - p.line('public string Value { get; set; }') - p.line() - p.line( - `public static implicit operator string(${name} value) => value.Value;` - ) - p.line( - `public static implicit operator ${name}(string value) => new ${name} { Value = value };` - ) - }) - p.line('}') - } - } else { - p.line(`public class ${name} : ${alias} { }`) - } - } else if (info.signature.has_class_signature) { - this.writeDataClass(c, name, info) - } else if (info.signature.has_type_signature) { - const discriminatedUnion = this.discriminatedUnions.get(info.symbol) - if (discriminatedUnion) { - this.writeSealedClass(c, name, info, discriminatedUnion) - } else if (this.isStringTypeInfo(info)) { - const constants = this.stringConstantsFromInfo(info) - if (constants.length > 0) { - this.writeEnum(p, name, constants) - } else { - p.line(`public class ${name} : String { }`) - } - } else { - this.writeDataClass(c, name, info) - } - } else { - throw new Error(`Unsupported signature: ${JSON.stringify(info.toObject(), null, 2)}`) - } - }) - p.line('}') - const filename = `${info.display_name}.${this.fileExtension()}` - .split('_') - .map(capitalize) - .join('') - fspromises.writeFile(path.join(this.options.output, filename), p.build()) - return - } - - if (this.language === TargetLanguage.Kotlin) { - p.line( - '@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")' - ) - } - p.line(`package ${this.options.kotlinPackage};`) - p.line() + this.emitter.startType(p, { name, info }) if (alias) { - if (this.language === TargetLanguage.Kotlin) { - p.line(`typealias ${name} = ${alias}`) - } else { - if (info.display_name === 'Date') { - p.line('public final class Date {}') - } else if (info.display_name === 'Null') { - p.line('public final class Null {}') - } else { - const constants = this.stringConstantsFromInfo(info) - if (constants.length === 0) { - this.reporter.warn(info.symbol, `no constants for ${info.display_name}`) - p.line(`public final class ${name} {} // TODO: fixme`) - } else { - this.writeEnum(p, name, constants) + const isStringType = this.isStringTypeInfo(info) + let enum_: Enum | undefined + if (isStringType) { + const constants = this.stringConstantsFromInfo(info) + if (constants.length > 0) { + enum_ = { + name, + members: constants.map(name => ({ + serializedName: name, + formattedName: f.formatFieldName(capitalize(name)), + })), } } } + this.emitter.emitTypeAlias(p, { + name, + alias, + isStringType, + info, + enum: enum_, + }) } else { const discriminatedUnion = this.discriminatedUnions.get(info.symbol) if (discriminatedUnion) { @@ -750,147 +330,64 @@ export class Codegen extends BaseCodegen { this.writeDataClass(c, name, info) } } - p.line() + this.emitter.closeType(p, { name, info }) await fspromises.writeFile( - path.join(this.options.output, `${name}.${this.fileExtension()}`), + path.join(this.options.output, this.emitter.getFileNameForType(info.display_name)), p.build() ) } private async writeProtocolInterface( name: string, - requests: string, - notifications: string + requestSymbol: string, + notificationSymbol: string ): Promise { const { f, p, symtab } = this.startDocument() - switch (this.language) { - case TargetLanguage.Kotlin: - p.line('@file:Suppress("FunctionName", "ClassName", "RedundantNullable")') - 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;') - break - case TargetLanguage.Java: - 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;') - break - case TargetLanguage.CSharp: - p.addImport('using System.Threading.Tasks;') - p.line() - p.line(`namespace ${this.options.kotlinPackage};`) - p.line('{') - break - } - p.line() - switch (this.language) { - case TargetLanguage.Kotlin: - p.line('@Suppress("unused")') - p.line(`interface ${name} {`) - break - case TargetLanguage.Java: - p.line('@SuppressWarnings("unused")') - p.line(`public interface ${name} {`) - break - case TargetLanguage.CSharp: - p.line('public interface ' + name) - p.line('{') - break - } - p.block(() => { - p.sectionComment('Requests') - for (const request of symtab.structuralType(symtab.canonicalSymbol(requests))) { - // We skip the webview protocol because our IDE clients are now - // using the string-encoded protocol instead. - if ( - request.display_name === 'webview/receiveMessage' || - request.display_name === 'chat/submitMessage' || - request.display_name === 'chat/editMessage' - ) { - continue - } - // Process a JSON-RPC request signature. For example: - // type Requests = { 'textDocument/inlineCompletions': [RequestParams, RequestResult] } - const resultType = request.signature.value_signature.tpe.type_ref.type_arguments?.[1] - if (resultType === undefined) { - this.reporter.error( - request.symbol, - `missing result type for request. To fix this problem, add a second element to the array type like this: 'example/method: [RequestParams, RequestResult]'` - ) - continue - } - const { parameterType, parameterSyntax } = f.jsonrpcMethodParameter(request) - this.queueClassLikeType(parameterType, request, 'parameter') - this.queueClassLikeType(resultType, request, 'result') - const resultTypeSyntax = f.jsonrpcTypeName(request, resultType, 'result') - switch (this.language) { - case TargetLanguage.Kotlin: - p.line(`@JsonRequest("${request.display_name}")`) - p.line( - `fun ${f.functionName(request)}(${parameterSyntax}): ` + - `CompletableFuture<${resultTypeSyntax}>` - ) - break - case TargetLanguage.Java: - p.line(`@JsonRequest("${request.display_name}")`) - p.line( - `CompletableFuture<${resultTypeSyntax}> ${f.functionName( - request - )}(${parameterSyntax});` - ) - break - case TargetLanguage.CSharp: { - p.line(`[JsonRpcMethod("${request.display_name}")]`) - const _task = resultTypeSyntax === 'Void' ? 'Task' : `Task<${resultTypeSyntax}>` - const _params = parameterSyntax.startsWith('Void') ? '' : parameterSyntax - const _func = capitalize(f.functionName(request)) - p.line(`${_task} ${_func}(${_params});`) - break - } - } + const requests: scip.SymbolInformation[] = [] + const notifications: scip.SymbolInformation[] = [] + + for (const request of symtab.structuralType(symtab.canonicalSymbol(requestSymbol))) { + // We skip the webview protocol because our IDE clients are now + // using the string-encoded protocol instead. + if ( + request.display_name === 'webview/receiveMessage' || + request.display_name === 'chat/submitMessage' || + request.display_name === 'chat/editMessage' + ) { + continue } - p.line() - p.sectionComment('Notifications') - for (const notification of symtab.structuralType(symtab.canonicalSymbol(notifications))) { - // We skip the webview protocol because our IDE clients are now - // using the string-encoded protocol instead. - if (notification.display_name === 'webview/postMessage') { - continue - } - // Process a JSON-RPC request signature. For example: - // type Notifications = { 'textDocument/inlineCompletions': [NotificationParams] } - const { parameterType, parameterSyntax } = f.jsonrpcMethodParameter(notification) - this.queueClassLikeType(parameterType, notification, 'parameter') - const notificationName = f.functionName(notification) - switch (this.language) { - case TargetLanguage.Kotlin: - p.line(`@JsonNotification("${notification.display_name}")`) - p.line(`fun ${notificationName}(${parameterSyntax})`) - break - case TargetLanguage.Java: - p.line(`@JsonNotification("${notification.display_name}")`) - p.line(`void ${notificationName}(${parameterSyntax});`) - break - case TargetLanguage.CSharp: - p.line(`[JsonRpcMethod("${notification.display_name}")]`) - p.line(`void ${capitalize(notificationName)}(${parameterSyntax});`) - break - } + // Process a JSON-RPC request signature. For example: + // type Requests = { 'textDocument/inlineCompletions': [RequestParams, RequestResult] } + const resultType = request.signature.value_signature.tpe.type_ref.type_arguments?.[1] + if (resultType === undefined) { + this.reporter.error( + request.symbol, + `missing result type for request. To fix this problem, add a second element to the array type like this: 'example/method: [RequestParams, RequestResult]'` + ) + continue } - }) - - p.line('}') + const { parameterType } = f.jsonrpcMethodParameter(request) + this.queueClassLikeType(parameterType, request, 'parameter') + this.queueClassLikeType(resultType, request, 'result') + requests.push(request) + } - if (this.language === TargetLanguage.CSharp) { - p.line('}') + for (const notification of symtab.structuralType(symtab.canonicalSymbol(notificationSymbol))) { + // We skip the webview protocol because our IDE clients are now + // using the string-encoded protocol instead. + if (notification.display_name === 'webview/postMessage') { + continue + } + // Process a JSON-RPC request signature. For example: + // type Notifications = { 'textDocument/inlineCompletions': [NotificationParams] } + const { parameterType } = f.jsonrpcMethodParameter(notification) + this.queueClassLikeType(parameterType, notification, 'parameter') + notifications.push(notification) } + this.emitter.emitProtocolInterface(p, { name, requests, notifications }) await fspromises.writeFile( - path.join(this.options.output, `${name}.${this.fileExtension()}`), + path.join(this.options.output, `${name}.${this.emitter.getFileType()}`), p.build() ) } @@ -906,13 +403,13 @@ export class Codegen extends BaseCodegen { 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)) { + } else if (this.emitter.formatter.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(this.language, type.type_ref.symbol)) { + } 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)) @@ -928,7 +425,7 @@ export class Codegen extends BaseCodegen { // aggregate properties of `A & B` or `{a: b, c: d}`. this.queueClassLikeInfo( new scip.SymbolInformation({ - display_name: this.f.jsonrpcTypeName(jsonrpcMethod, type, kind), + display_name: this.emitter.formatter.jsonrpcTypeName(jsonrpcMethod, type, kind), // Need unique symbol for parameter+result types symbol: `${jsonrpcMethod.symbol}(${kind}).`, signature: new scip.Signature({ @@ -949,10 +446,12 @@ export class Codegen extends BaseCodegen { } if (type.has_union_type) { - const nonNullableTypes = type.union_type.types.filter(type => !this.f.isNullable(type)) + const nonNullableTypes = type.union_type.types.filter( + type => !this.emitter.formatter.isNullable(type) + ) if ( nonNullableTypes.every( - tpe => tpe.has_type_ref && isTypescriptKeyword(this.language, tpe.type_ref.symbol) + tpe => tpe.has_type_ref && isTypescriptKeyword(tpe.type_ref.symbol) ) ) { // Nothing to queue @@ -968,8 +467,8 @@ export class Codegen extends BaseCodegen { // 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) + const exceptionIndex = this.emitter.formatter.unionTypeExceptionIndex.find( + ({ prefix }) => jsonrpcMethod.symbol.startsWith(prefix) )?.index if (exceptionIndex !== undefined) { this.reporter.warn( @@ -1017,6 +516,7 @@ export class Codegen extends BaseCodegen { loop(type) return result } + private discriminatedUnion(info: scip.SymbolInformation): DiscriminatedUnion | undefined { if (!info.signature.has_type_signature) { return undefined @@ -1025,9 +525,22 @@ export class Codegen extends BaseCodegen { if (!type.has_union_type || type.union_type.types.length === 0) { return undefined } + const unionTypes = this.unionTypes(type) + // HACK: We have to special case the `AuthStatus` type because it's + // SCIP doesn't recognize the `authenticated` member as a constant type + // and thus picks the wrong discriminator + if (info.display_name === 'AuthStatus') { + return { + symbol: info.symbol, + discriminatorDisplayName: 'authenticated', + members: unionTypes.map(type => ({ + type, + value: type.type_ref.symbol.includes('Authenticated'), + })), + } + } const candidates = new Map() const memberss = new Map() - const unionTypes = this.unionTypes(type) for (const unionType of unionTypes) { for (const propertySymbol of this.properties(unionType)) { const property = this.symtab.info(propertySymbol) diff --git a/agent/src/cli/scip-codegen/Formatter.ts b/agent/src/cli/scip-codegen/Formatter.ts index 6365e76755c4..1be2c480f12f 100644 --- a/agent/src/cli/scip-codegen/Formatter.ts +++ b/agent/src/cli/scip-codegen/Formatter.ts @@ -1,23 +1,31 @@ import type { DiscriminatedUnion, DiscriminatedUnionMember } from './BaseCodegen' -import { type Codegen, TargetLanguage } from './Codegen' +import type { Codegen } from './Codegen' import type { SymbolTable } from './SymbolTable' import { isNullOrUndefinedOrUnknownType } from './isNullOrUndefinedOrUnknownType' import type { scip } from './scip' -import { capitalize, typescriptKeyword, typescriptKeywordSyntax } from './utils' - -export class Formatter { +import { TypescriptKeyword, capitalize, typescriptKeyword, typescriptKeywordSyntax } from './utils' + +export interface LanguageOptions { + typeNameSeparator: string + typeAnnotations: 'before' | 'after' + voidType: string + nullableSyntax?: string + reserved: Set + keywordOverrides: Map +} +export abstract class Formatter { constructor( - private readonly language: TargetLanguage, private readonly symtab: SymbolTable, private codegen: Codegen ) {} + + public abstract options: LanguageOptions + public abstract mapSyntax(key: string, value: string): string + public abstract listSyntax(elementType: string): string + public abstract formatFieldName(name: string): string + public functionName(info: scip.SymbolInformation): string { - switch (this.language) { - case TargetLanguage.CSharp: - return info.display_name.replaceAll('$/', '').split('/').map(capitalize).join('') - default: - return info.display_name.replaceAll('$/', '').replaceAll('/', '_') - } + return info.display_name.replaceAll('$/', '').replaceAll('/', '_') } public typeName(info: scip.SymbolInformation): string { @@ -29,7 +37,7 @@ export class Formatter { .replaceAll('$/', '') .split('/') .map(part => capitalize(part)) - .join(this.language === TargetLanguage.CSharp ? '' : '_') + .join(this.options.typeNameSeparator) } public jsonrpcMethodParameter(jsonrpcMethod: scip.SymbolInformation): { @@ -38,7 +46,7 @@ export class Formatter { } { const parameterType = jsonrpcMethod.signature.value_signature.tpe.type_ref.type_arguments[0] const parameterSyntax = this.jsonrpcTypeName(jsonrpcMethod, parameterType, 'parameter') - if (this.language === TargetLanguage.Kotlin) { + if (this.options.typeAnnotations === 'after') { return { parameterType, parameterSyntax: `params: ${parameterSyntax}` } } return { parameterType, parameterSyntax: `${parameterSyntax} params` } @@ -52,14 +60,10 @@ export class Formatter { return this.isNullable(info.signature.value_signature.tpe) } public nullableSyntax(tpe: scip.Type): string { - if (this.language === TargetLanguage.Java) { - // TODO: emit @Nullable - return '' + if (this.options.nullableSyntax && this.isNullable(tpe)) { + return this.options.nullableSyntax } - if (this.language === TargetLanguage.CSharp) { - return '' - } - return this.isNullable(tpe) ? '?' : '' + return '' } public isNullable(tpe: scip.Type): boolean { @@ -94,31 +98,19 @@ export class Formatter { const [k, v] = parameterOrResultType.type_ref.type_arguments const key = this.jsonrpcTypeName(jsonrpcMethod, k, kind) const value = this.jsonrpcTypeName(jsonrpcMethod, v, kind) - if (this.language === TargetLanguage.Kotlin) { - return `Map<${key}, ${value}>` - } - if (this.language === TargetLanguage.CSharp) { - return `Dictionary<${key}, ${value}>` - } - return `java.util.Map<${key}, ${value}>` + return this.mapSyntax(key, value) } - const keyword = typescriptKeywordSyntax(this.language, parameterOrResultType.type_ref.symbol) - if (keyword === 'List') { + const keyword = typescriptKeywordSyntax(parameterOrResultType.type_ref.symbol) + if (keyword === TypescriptKeyword.List) { const elementType = this.jsonrpcTypeName( jsonrpcMethod, parameterOrResultType.type_ref.type_arguments[0], kind ) - if (this.language === TargetLanguage.Kotlin) { - return `List<${elementType}>` - } - if (this.language === TargetLanguage.CSharp) { - return `${elementType}[]` - } - return `java.util.List<${elementType}>` + return this.listSyntax(elementType) } if (keyword) { - return this.languageSpecificKeyword(keyword) + return this.options.keywordOverrides.get(keyword) ?? keyword } return this.typeName(this.symtab.info(parameterOrResultType.type_ref.symbol)) } @@ -147,10 +139,7 @@ export class Formatter { tpe => !this.isNullable(tpe) ) if (nonNullableTypes.length === 0) { - if (this.language === TargetLanguage.Kotlin) { - return 'Null' - } - return 'Void' + return this.options.voidType } if (nonNullableTypes.length === 1) { return this.nonNullableJsonrpcTypeName(jsonrpcMethod, nonNullableTypes[0], kind) @@ -186,25 +175,6 @@ export class Formatter { ) } - private languageSpecificKeyword(keyword: string): string { - switch (this.language) { - case TargetLanguage.Kotlin: - case TargetLanguage.Java: - return keyword - case TargetLanguage.CSharp: - switch (keyword) { - case 'Boolean': - return 'bool' - case 'String': - return 'string' - case 'Long': - return 'int' - default: - return keyword - } - } - } - public readonly ignoredProperties = [ 'npm @sourcegraph/telemetry ', // Too many complicated types from this package ] @@ -242,55 +212,6 @@ export class Formatter { ) } - // Incomplete, but useful list of keywords. Thank you Cody! - private kotlinKeywords = new Set([ - 'class', - 'interface', - 'object', - 'package', - 'typealias', - 'val', - 'var', - 'fun', - 'when', - ]) - private javaKeywords = new Set([ - 'class', - 'interface', - 'object', - 'package', - 'var', - 'default', - 'case', - 'switch', - 'native', - ]) - - public formatFieldName(name: string): string { - const escaped = name.replace(':', '_').replace('/', '_') - if (this.language === TargetLanguage.Kotlin) { - const isKeyword = this.kotlinKeywords.has(escaped) - const needsBacktick = isKeyword || !/^[a-zA-Z0-9_]+$/.test(escaped) - // Replace all non-alphanumeric characters with underscores - const fieldName = getEscapedValue(escaped, '-') - return needsBacktick ? `\`${fieldName}\`` : fieldName - } - // CSharp - if (this.language === TargetLanguage.CSharp) { - return getEscapedValue(escaped) - .split('_') - .map(part => part.charAt(0).toUpperCase() + part.slice(1)) - .join('') - .replaceAll('_', '') - } - // Java - const isKeyword = this.javaKeywords.has(escaped) - if (isKeyword) { - return escaped + '_' - } - return escaped.replace(/[^a-zA-Z0-9]/g, '_') - } - public discriminatedUnionTypeName( union: DiscriminatedUnion, member: DiscriminatedUnionMember @@ -302,18 +223,19 @@ export class Formatter { this.formatFieldName(member.value + this.symtab.info(union.symbol).display_name) ) } + public formatEnumType(name: string): string { return `${capitalize(name)}Enum` } -} -function getEscapedValue(name: string, replacer: '_' | '-' = '_'): string { - const nonAlphanumericRegex = replacer === '-' ? /[^a-zA-Z0-9]+/g : /[^a-zA-Z0-9]/g - const repeatedReplacerRegex = new RegExp(`${replacer}+`, 'g') - const trimReplacerRegex = new RegExp(`^${replacer}|${replacer}$`, 'g') + protected escape(name: string, replacer: '_' | '-' = '_'): string { + const nonAlphanumericRegex = replacer === '-' ? /[^a-zA-Z0-9]+/g : /[^a-zA-Z0-9]/g + const repeatedReplacerRegex = new RegExp(`${replacer}+`, 'g') + const trimReplacerRegex = new RegExp(`^${replacer}|${replacer}$`, 'g') - return name - .replace(nonAlphanumericRegex, replacer) - .replace(repeatedReplacerRegex, replacer) - .replace(trimReplacerRegex, '') + return name + .replace(nonAlphanumericRegex, replacer) + .replace(repeatedReplacerRegex, replacer) + .replace(trimReplacerRegex, '') + } } diff --git a/agent/src/cli/scip-codegen/emitters/CSharpEmitter.ts b/agent/src/cli/scip-codegen/emitters/CSharpEmitter.ts new file mode 100644 index 000000000000..aa40e7e605ca --- /dev/null +++ b/agent/src/cli/scip-codegen/emitters/CSharpEmitter.ts @@ -0,0 +1,295 @@ +import type { CodePrinter } from '../../../../../vscode/src/completions/context/retrievers/tsc/CodePrinter' +import type { Codegen } from '../Codegen' +import { Formatter, type LanguageOptions } from '../Formatter' +import type { SymbolTable } from '../SymbolTable' +import type { CodegenOptions } from '../command' +import type { scip } from '../scip' +import { TypescriptKeyword, capitalize } from '../utils' +import type { + DataClassOptions, + Emitter, + Enum, + ProtocolInterface, + SealedClassOptions, + TypeAliasOptions, + TypeOptions, +} from './Emitter' + +export class CSharpEmitter implements Emitter { + formatter: CSharpFormatter + + constructor( + private options: CodegenOptions, + symtab: SymbolTable, + codegen: Codegen + ) { + this.formatter = new CSharpFormatter(symtab, codegen) + } + + emitSerializationAdapter(p: CodePrinter, discriminatedUnions: string[]): void { + p.line(`namespace ${this.options.kotlinPackage}`) + p.line('{') + p.block(() => { + p.line('public static class ProtocolTypeAdapters') + p.line('{') + p.block(() => { + p.line('public static void Register(JsonSerializerOptions options)') + p.line('{') + for (const name of discriminatedUnions) { + p.line(`options.Converters.Add(new ${name}Converter());`) + } + }) + p.line('}') + }) + p.line('}') + } + + emitNullAlias(p: CodePrinter): void { + p.line(`namespace ${this.options.kotlinPackage};`) + p.line('{') + p.block(() => { + p.line('public sealed class Null {}') + }) + p.line('}') + } + + emitStringLiteralConstants(p: CodePrinter, stringLiterals: string[]): void { + p.line(`namespace ${this.options.kotlinPackage};`) + p.line('{') + p.line('public static class Constants') + p.line('{') + p.block(() => { + for (const literal of stringLiterals) { + p.line(`public const string ${this.formatter.formatFieldName(literal)} = "${literal}";`) + } + }) + p.line('}') + p.line('}') + } + + emitProtocolInterface(p: CodePrinter, { name, requests, notifications }: ProtocolInterface): void { + p.addImport('using System.Threading.Tasks;') + p.line() + p.line(`namespace ${this.options.kotlinPackage};`) + p.line('{') + p.line() + p.line('public interface ' + name) + p.line('{') + + p.block(() => { + p.sectionComment('Requests') + for (const request of requests) { + const resultType = request.signature.value_signature.tpe.type_ref.type_arguments?.[1] + const { parameterSyntax } = this.formatter.jsonrpcMethodParameter(request) + const resultTypeSyntax = this.formatter.jsonrpcTypeName(request, resultType, 'result') + p.line(`[JsonRpcMethod("${request.display_name}")]`) + const _task = resultTypeSyntax === 'Void' ? 'Task' : `Task<${resultTypeSyntax}>` + const _params = parameterSyntax.startsWith('Void') ? '' : parameterSyntax + const _func = capitalize(this.formatter.functionName(request)) + p.line(`${_task} ${_func}(${_params});`) + } + + p.line() + p.sectionComment('Notifications') + for (const notification of notifications) { + const { parameterSyntax } = this.formatter.jsonrpcMethodParameter(notification) + const notificationName = this.formatter.functionName(notification) + p.line(`[JsonRpcMethod("${notification.display_name}")]`) + p.line(`void ${capitalize(notificationName)}(${parameterSyntax});`) + } + }) + p.line('}') + p.line('}') + } + + startType(p: CodePrinter, _: TypeOptions): void { + p.addImport('using Newtonsoft.Json;') + p.line() + p.line(`namespace ${this.options.kotlinPackage}`) + p.line('{') + } + + closeType(p: CodePrinter, _: TypeOptions): void { + p.line('}') + } + + emitTypeAlias(p: CodePrinter, { name, alias, isStringType, enum: enum_ }: TypeAliasOptions): void { + p.block(() => { + if (isStringType) { + if (enum_) { + this.emitEnum(p, enum_) + } else { + // Create an implicit string wrapper class + p.line(`public class ${name}`) + p.line('{') + p.block(() => { + p.line('public string Value { get; set; }') + p.line() + p.line(`public static implicit operator string(${name} value) => value.Value;`) + p.line( + `public static implicit operator ${name}(string value) => new ${name} { Value = value };` + ) + }) + p.line('}') + } + } else { + // Create a class that inherits from the alias + p.line(`public class ${name} : ${alias} {}`) + } + }) + + p.line('}') + } + + startSealedClass(p: CodePrinter, { name, union }: SealedClassOptions): void { + p.addImport('using Newtonsoft.Json;') + p.line(`[JsonConverter(typeof(${name}Converter))]`) + name = name.split(/[ -]/).map(capitalize).join('') + p.line(`public abstract class ${name}`) + p.line('{') + p.block(() => { + p.line(`private class ${name}Converter : JsonConverter<${name}>`) + p.line('{') + p.block(() => { + p.line( + `public override ${name} Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)` + ) + p.line('{') + p.block(() => { + p.line('var jsonDoc = JsonDocument.ParseValue(ref reader);') + p.line( + `var discriminator = jsonDoc.RootElement.GetProperty("${union.discriminatorDisplayName}").GetString();` + ) + p.line('switch (discriminator)') + p.line('{') + p.block(() => { + for (const member of union.members) { + const typeName = this.formatter.discriminatedUnionTypeName(union, member) + p.line(`case "${member.value}":`) + p.block(() => { + p.line( + `return JsonSerializer.Deserialize<${typeName}>(jsonDoc.RootElement.GetRawText(), options);` + ) + }) + } + p.line('default:') + p.block(() => { + p.line('throw new JsonException($"Unknown discriminator {discriminator}");') + }) + p.line('}') + }) + + p.line( + `public override void Write(Utf8JsonWriter writer, ${name} value, JsonSerializerOptions options` + ) + p.line('{') + p.block(() => + p.line('JsonSerializer.Serialize(writer, value, value.GetType(), options);') + ) + + p.line('}') + }) + }) + p.line('}') + }) + } + + closeSealedClass(p: CodePrinter, _: SealedClassOptions): void { + p.line('}') + } + + emitDataClass( + p: CodePrinter, + { name, members, enums, parentClass, isStringType }: DataClassOptions + ): void { + // Special case for string types + if (isStringType) { + for (const enum_ of enums) { + this.emitEnum(p, enum_) + } + if (enums.length === 0) { + p.line(`public class ${name} : string {}`) + } + return + } + const heritage = parentClass ? ` : ${parentClass}` : '' + p.line(`public class ${name}${heritage}`) + p.line('{') + p.block(() => { + for (const { info, typeSyntax, formattedName, oneOfComment } of members) { + p.line(`[JsonProperty(PropertyName = "${info.display_name}")]`) + if (oneOfComment.includes('-')) { + p.line(`public string ${formattedName} { get; set; }${oneOfComment}`) + } else { + p.line(`public ${typeSyntax} ${formattedName} { get; set; }${oneOfComment}`) + } + } + if (members.length === 0) { + p.line('public string PlaceholderField { get; set; } // Empty class') + } + }) + + if (enums.length > 0) { + p.addImport('using Newtonsoft.Json;') + for (const enum_ of enums) { + this.emitEnum(p, enum_) + } + } + p.line('}') + } + + emitEnum(p: CodePrinter, { name, members }: Enum): void { + p.line() + p.line(`public enum ${name}`) + p.line('{') + p.block(() => { + for (const { serializedName, formattedName } of members) { + p.line(`${formattedName}, // ${serializedName}`) + } + }) + p.line('}') + } + + getFileType(): string { + return 'cs' + } + + getFileNameForType(tpe: string): string { + return `${tpe}.${this.getFileType()}`.split('_').map(capitalize).join('') + } +} + +export class CSharpFormatter extends Formatter { + override options: LanguageOptions = { + typeNameSeparator: '', + typeAnnotations: 'after', + voidType: 'Void', + reserved: new Set(), + keywordOverrides: new Map([ + [TypescriptKeyword.Boolean, 'bool'], + [TypescriptKeyword.String, 'string'], + [TypescriptKeyword.Long, 'int'], + ]), + } + + override functionName(info: scip.SymbolInformation): string { + return info.display_name.replaceAll('$/', '').split('/').map(capitalize).join('') + } + + override mapSyntax(key: string, value: string): string { + return `Dictionary<${key}, ${value}>` + } + + override listSyntax(value: string): string { + return `${value}[]` + } + + override formatFieldName(name: string): string { + const escaped = name.replace(':', '_').replace('/', '_') + return this.escape(escaped) + .split('_') + .map(part => part.charAt(0).toUpperCase() + part.slice(1)) + .join('') + .replaceAll('_', '') + } +} diff --git a/agent/src/cli/scip-codegen/emitters/Emitter.ts b/agent/src/cli/scip-codegen/emitters/Emitter.ts new file mode 100644 index 000000000000..80927f213e37 --- /dev/null +++ b/agent/src/cli/scip-codegen/emitters/Emitter.ts @@ -0,0 +1,84 @@ +import type { CodePrinter } from '../../../../../vscode/src/completions/context/retrievers/tsc/CodePrinter' +import type { DiscriminatedUnion } from '../BaseCodegen' +import type { Formatter } from '../Formatter' +import type { scip } from '../scip' + +export interface Emitter { + emitSerializationAdapter(p: CodePrinter, discriminatedUnions: string[]): void + + emitStringLiteralConstants(p: CodePrinter, stringLiterals: string[]): void + + emitNullAlias(p: CodePrinter): void + + emitProtocolInterface(p: CodePrinter, options: ProtocolInterface): void + + startType(p: CodePrinter, options: TypeOptions): void + closeType(p: CodePrinter, options: TypeOptions): void + emitTypeAlias(p: CodePrinter, options: TypeAliasOptions): void + + startSealedClass(p: CodePrinter, options: SealedClassOptions): void + closeSealedClass?(p: CodePrinter, options: SealedClassOptions): void + + emitDataClass(p: CodePrinter, options: DataClassOptions): void + + emitEnum(p: CodePrinter, _enum: Enum): void + + getFileType(): string + getFileNameForType(tpe: string): string + + formatter: Formatter +} + +export interface ProtocolInterface { + name: string + requests: scip.SymbolInformation[] + notifications: scip.SymbolInformation[] +} + +export interface TypeAliasOptions { + name: string + alias: string + isStringType: boolean + info: scip.SymbolInformation + enum?: Enum +} + +export interface TypeOptions { + name: string + info: scip.SymbolInformation + enum?: Enum +} + +export interface SealedClassOptions { + name: string + info: scip.SymbolInformation + union: DiscriminatedUnion +} + +export interface DataClassOptions { + name: string + info: scip.SymbolInformation + members: Member[] + enums: Enum[] + parentClass?: string + innerClass?: boolean + isStringType?: boolean +} + +export interface Member { + info: scip.SymbolInformation + formattedName: string + typeSyntax: string + isNullable: boolean + oneOfComment: string +} + +export interface Enum { + name: string + members: EnumMember[] +} + +export interface EnumMember { + serializedName: string + formattedName: string +} diff --git a/agent/src/cli/scip-codegen/emitters/JavaEmitter.ts b/agent/src/cli/scip-codegen/emitters/JavaEmitter.ts new file mode 100644 index 000000000000..5ca542374af7 --- /dev/null +++ b/agent/src/cli/scip-codegen/emitters/JavaEmitter.ts @@ -0,0 +1,306 @@ +import type { CodePrinter } from '../../../../../vscode/src/completions/context/retrievers/tsc/CodePrinter' +import { + type ConstantType, + type DiscriminatedUnion, + type DiscriminatedUnionMember, + typeOfUnion, +} from '../BaseCodegen' +import type { Codegen } from '../Codegen' +import { Formatter, type LanguageOptions } from '../Formatter' +import type { SymbolTable } from '../SymbolTable' +import type { CodegenOptions } from '../command' +import { TypescriptKeyword } from '../utils' +import type { + DataClassOptions, + Emitter, + Enum, + ProtocolInterface, + SealedClassOptions, + TypeAliasOptions, + TypeOptions, +} from './Emitter' + +export class JavaEmitter implements Emitter { + formatter: JavaFormatter + + constructor( + private options: CodegenOptions, + symtab: SymbolTable, + codegen: Codegen + ) { + this.formatter = new JavaFormatter(symtab, codegen) + } + + emitSerializationAdapter(p: CodePrinter, discriminatedUnions: string[]): void { + p.line(`package ${this.options.kotlinPackage};`) + p.line() + p.line('public final class ProtocolTypeAdapters {') + + p.block(() => { + p.line('public static void register(com.google.gson.GsonBuilder gson) {') + p.block(() => { + for (const name of discriminatedUnions) { + p.line(`gson.registerTypeAdapter(${name}.class, ${name}.deserializer());`) + } + }) + p.line('}') + }) + p.line('}') + } + + emitStringLiteralConstants(p: CodePrinter, stringLiterals: string[]): void { + p.line(`package ${this.options.kotlinPackage};`) + p.line() + p.line('public final class Constants {') + + p.block(() => { + for (const literal of stringLiterals) { + p.line( + `public static final String ${this.formatter.formatFieldName( + literal + )} = "${literal}";` + ) + } + }) + p.line('}') + } + + emitNullAlias(p: CodePrinter): void { + p.line(`package ${this.options.kotlinPackage};`) + p.line() + p.line('public final class Null {}') + } + + emitProtocolInterface(p: CodePrinter, { name, requests, notifications }: ProtocolInterface): void { + 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('@SuppressWarnings("unused")') + p.line(`public interface ${name} {`) + + p.block(() => { + p.sectionComment('Requests') + for (const request of requests) { + const resultType = request.signature.value_signature.tpe.type_ref.type_arguments?.[1] + const { parameterSyntax } = this.formatter.jsonrpcMethodParameter(request) + const resultTypeSyntax = this.formatter.jsonrpcTypeName(request, resultType, 'result') + p.line(`@JsonRequest("${request.display_name}")`) + p.line( + `CompletableFuture<${resultTypeSyntax}> ${this.formatter.functionName( + request + )}(${parameterSyntax});` + ) + p.line() + } + + p.line() + p.sectionComment('Notifications') + for (const notification of notifications) { + const { parameterSyntax } = this.formatter.jsonrpcMethodParameter(notification) + p.line(`@JsonNotification("${notification.display_name}")`) + p.line(`void ${this.formatter.functionName(notification)}(${parameterSyntax});`) + } + }) + + p.line('}') + } + + startType(p: CodePrinter, _: TypeOptions): void { + p.line(`package ${this.options.kotlinPackage};`) + p.line() + } + + closeType(p: CodePrinter, _: TypeOptions): void { + p.line() + } + + emitTypeAlias(p: CodePrinter, { name, info, enum: enum_ }: TypeAliasOptions): void { + if (name === 'Date') { + p.line('public final class Date {}') + } else if (info.display_name === 'Null') { + p.line('public final class Null {}') + } + if (enum_) { + this.emitEnum(p, enum_) + } else { + p.line(`public final class ${name} {} // TODO: fixme`) + } + } + + startSealedClass(p: CodePrinter, { name, union }: SealedClassOptions): void { + function getDeserializer(union: DiscriminatedUnion): string { + switch (typeOfUnion(union)) { + case 'boolean': + return 'getAsBoolean' + case 'number': + return 'getAsInt' + case 'string': + return 'getAsString' + } + } + function formatValueLiteral(value: ConstantType): string { + switch (typeof value) { + case 'string': + return `"${value}"` + case 'number': + return value.toString() + case 'boolean': + return value.toString() + default: + throw new TypeError('Invalid value type') + } + } + + const getDeserializationClause = (member?: DiscriminatedUnionMember): string | undefined => { + if (!member) return undefined + + const typeName = member ? this.formatter.discriminatedUnionTypeName(union, member) : 'Void' + return `return context.deserialize(element, ${typeName}.class);` + } + + p.line('import com.google.gson.Gson;') + p.line('import com.google.gson.JsonDeserializationContext;') + p.line('import com.google.gson.JsonDeserializer;') + p.line('import com.google.gson.JsonElement;') + p.line('import java.lang.reflect.Type;') + p.line() + p.line(`public abstract class ${name} {`) + p.block(() => { + p.line(`public static JsonDeserializer<${name}> deserializer() {`) + p.block(() => { + p.line('return (element, _type, context) -> {') + p.block(() => { + // In Java, we can't switch on booleans, so we have to use if-else + if (typeOfUnion(union) === 'boolean') { + const trueCase = union.members.find(m => m.value === true) + const falseCase = union.members.find(m => m.value === false) + p.line( + `if (element.getAsJsonObject().get("${union.discriminatorDisplayName}").getAsBoolean()) {` + ) + p.block(() => { + p.line(getDeserializationClause(trueCase)) + }) + p.line('} else {') + p.block(() => { + p.line(getDeserializationClause(falseCase)) + }) + p.line('}') + } else { + p.line( + `switch (element.getAsJsonObject().get("${ + union.discriminatorDisplayName + }").${getDeserializer(union)}()) {` + ) + p.block(() => { + for (const member of union.members) { + const typeName = this.formatter.discriminatedUnionTypeName(union, member) + p.line( + `case ${formatValueLiteral( + member.value + )}: return context.deserialize(element, ${typeName}.class);` + ) + } + p.line( + 'default: throw new RuntimeException("Unknown discriminator " + element);' + ) + }) + p.line('}') + } + }) + p.line('};') + }) + p.line('}') + }) + } + + closeSealedClass(p: CodePrinter, _: SealedClassOptions): void { + p.line('}') + } + + emitDataClass( + p: CodePrinter, + { name, members, enums, innerClass, parentClass }: DataClassOptions + ): void { + const staticModifier = innerClass ? 'static ' : '' + const heritage = parentClass ? ` extends ${parentClass}` : '' + p.line(`public ${staticModifier}final class ${name}${heritage} {`) + + p.block(() => { + for (const { info, typeSyntax, formattedName, oneOfComment } of members) { + const serializedAnnotation = + formattedName === info.display_name + ? '' + : `@com.google.gson.annotations.SerializedName("${info.display_name}") ` + p.line(`${serializedAnnotation}public ${typeSyntax} ${formattedName};${oneOfComment}`) + } + }) + + p.block(() => { + for (const _enum of enums) { + this.emitEnum(p, _enum) + } + }) + p.line('}') + } + + emitEnum(p: CodePrinter, { name, members }: Enum): void { + p.line() + p.line(`public enum ${name} {`) + p.block(() => { + for (const member of members) { + p.line( + `@com.google.gson.annotations.SerializedName("${member.serializedName}") ${member.formattedName},` + ) + } + }) + p.line('}') + } + + getFileNameForType(tpe: string): string { + return `${tpe}.${this.getFileType()}` + } + + getFileType(): string { + return 'java' + } +} + +export class JavaFormatter extends Formatter { + public options: LanguageOptions = { + typeNameSeparator: '_', + typeAnnotations: 'before', + voidType: 'Void', + reserved: new Set([ + 'class', + 'interface', + 'object', + 'package', + 'var', + 'default', + 'case', + 'switch', + 'native', + ]), + keywordOverrides: new Map([[TypescriptKeyword.Null, 'Void']]), + } + + mapSyntax(key: string, value: string): string { + return `java.util.Map<${key}, ${value}>` + } + + listSyntax(value: string): string { + return `java.util.List<${value}>` + } + + override formatFieldName(name: string): string { + const escaped = name.replace(':', '_').replace('/', '_') + const isKeyword = this.options.reserved.has(escaped) + if (isKeyword) { + return escaped + '_' + } + return escaped.replace(/[^a-zA-Z0-9]/g, '_') + } +} diff --git a/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts b/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts new file mode 100644 index 000000000000..d5416e7dd14b --- /dev/null +++ b/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts @@ -0,0 +1,276 @@ +import type { CodePrinter } from '../../../../../vscode/src/completions/context/retrievers/tsc/CodePrinter' +import { type ConstantType, type DiscriminatedUnion, typeOfUnion } from '../BaseCodegen' +import type { Codegen } from '../Codegen' +import { Formatter, type LanguageOptions } from '../Formatter' +import type { SymbolTable } from '../SymbolTable' +import type { CodegenOptions } from '../command' +import { TypescriptKeyword } from '../utils' +import type { + DataClassOptions, + Emitter, + Enum, + ProtocolInterface, + SealedClassOptions, + TypeAliasOptions, + TypeOptions, +} from './Emitter' + +export class KotlinEmitter implements Emitter { + formatter: KotlinFormatter + constructor( + private options: CodegenOptions, + symtab: SymbolTable, + codegen: Codegen + ) { + this.formatter = new KotlinFormatter(symtab, codegen) + } + + emitStringLiteralConstants(p: CodePrinter, stringLiterals: string[]): void { + p.line('@file:Suppress("unused", "ConstPropertyName")') + p.line(`package ${this.options.kotlinPackage};`) + p.line() + p.line('object Constants {') + p.block(() => { + for (const literal of stringLiterals) { + p.line(`const val ${this.formatter.formatFieldName(literal)} = "${literal}"`) + } + }) + p.line('}') + } + + emitNullAlias(p: CodePrinter): void { + p.line(`package ${this.options.kotlinPackage};`) + p.line() + p.line('typealias Null = Void?') + } + + emitSerializationAdapter(p: CodePrinter, discriminatedUnions: string[]): void { + p.line('@file:Suppress("unused", "ConstPropertyName")') + p.line(`package ${this.options.kotlinPackage};`) + p.line() + p.line('object ProtocolTypeAdapters {') + + p.block(() => { + p.line('fun register(gson: com.google.gson.GsonBuilder) {') + p.block(() => { + for (const name of discriminatedUnions) { + p.line(`gson.registerTypeAdapter(${name}::class.java, ${name}.deserializer)`) + } + }) + p.line('}') + }) + p.line('}') + } + + emitProtocolInterface(p: CodePrinter, { name, requests, notifications }: ProtocolInterface): void { + p.line('@file:Suppress("FunctionName", "ClassName", "RedundantNullable")') + 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 requests) { + const resultType = request.signature.value_signature.tpe.type_ref.type_arguments?.[1] + const { parameterSyntax } = this.formatter.jsonrpcMethodParameter(request) + const resultTypeSyntax = this.formatter.jsonrpcTypeName(request, resultType, 'result') + p.line(`@JsonRequest("${request.display_name}")`) + p.line( + `fun ${this.formatter.functionName( + request + )}(${parameterSyntax}): CompletableFuture<${resultTypeSyntax}>` + ) + } + p.line() + p.sectionComment('Notifications') + for (const notification of notifications) { + // Process a JSON-RPC request signature. For example: + // type Notifications = { 'textDocument/inlineCompletions': [NotificationParams] } + const { parameterSyntax } = this.formatter.jsonrpcMethodParameter(notification) + const notificationName = this.formatter.functionName(notification) + p.line(`@JsonNotification("${notification.display_name}")`) + p.line(`fun ${notificationName}(${parameterSyntax})`) + } + }) + + p.line('}') + } + + startType(p: CodePrinter, _: TypeOptions): void { + p.line('@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport")') + p.line(`package ${this.options.kotlinPackage};`) + p.line() + } + + closeType(p: CodePrinter, _: TypeOptions): void { + p.line() + } + + emitTypeAlias(p: CodePrinter, { name, alias }: TypeAliasOptions): void { + p.line(`typealias ${name} = ${alias}`) + } + + startSealedClass(p: CodePrinter, { name, union }: SealedClassOptions): void { + function getDeserializer(union: DiscriminatedUnion): string { + switch (typeOfUnion(union)) { + case 'boolean': + return 'getAsBoolean' + case 'number': + return 'getAsInt' + case 'string': + return 'getAsString' + } + } + function formatValueLiteral(value: ConstantType): string { + switch (typeof value) { + case 'string': + return `"${value}"` + case 'number': + return value.toString() + case 'boolean': + return value.toString() + } + } + p.line('import com.google.gson.Gson;') + p.line('import com.google.gson.JsonDeserializationContext;') + p.line('import com.google.gson.JsonDeserializer;') + p.line('import com.google.gson.JsonElement;') + p.line('import java.lang.reflect.Type;') + p.line() + p.line(`sealed class ${name} {`) + p.block(() => { + p.line('companion object {') + p.block(() => { + p.line(`val deserializer: JsonDeserializer<${name}> =`) + p.block(() => { + p.line( + 'JsonDeserializer { element: JsonElement, _: Type, context: JsonDeserializationContext ->' + ) + p.block(() => { + p.line( + `when (element.getAsJsonObject().get("${ + union.discriminatorDisplayName + }").${getDeserializer(union)}()) {` + ) + p.block(() => { + for (const member of union.members) { + const typeName = this.formatter.discriminatedUnionTypeName(union, member) + p.line( + `${formatValueLiteral( + member.value + )} -> context.deserialize<${typeName}>(element, ${typeName}::class.java)` + ) + } + if (typeOfUnion(union) !== 'boolean') { + p.line('else -> throw Exception("Unknown discriminator ${element}")') + } + }) + p.line('}') + }) + p.line('}') + }) + }) + p.line('}') + }) + p.line('}') + } + + emitDataClass( + p: CodePrinter, + { name, members, enums, parentClass, innerClass }: DataClassOptions + ): void { + if (innerClass) { + p.line() + } + p.line(`data class ${name}(`) + p.block(() => { + for (const member of members) { + p.line( + `val ${member.info.display_name}: ${member.typeSyntax}${ + member.isNullable ? ' = null' : '' + },${member.oneOfComment}` + ) + } + if (members.length === 0) { + p.line('val placeholderField: String? = null // Empty data class') + } + }) + const heritage = parentClass ? ` : ${parentClass}()` : '' + if (enums.length === 0) { + p.line(`)${heritage}`) + } else { + p.line(`)${heritage} {`) + p.block(() => { + p.addImport('import com.google.gson.annotations.SerializedName;') + for (const enum_ of enums) { + this.emitEnum(p, enum_) + } + }) + p.line('}') + } + } + + emitEnum(p: CodePrinter, { name, members }: Enum): void { + p.line() + p.line(`enum class ${name} {`) + p.block(() => { + for (const member of members) { + p.line(`@SerializedName("${member.serializedName}") ${member.formattedName},`) + } + }) + p.line('}') + } + + getFileNameForType(tpe: string): string { + return `${tpe}.${this.getFileType()}` + } + + getFileType(): string { + return 'kt' + } +} + +export class KotlinFormatter extends Formatter { + public options: LanguageOptions = { + typeNameSeparator: '_', + typeAnnotations: 'after', + nullableSyntax: '?', + voidType: 'Null', + reserved: new Set([ + 'class', + 'interface', + 'object', + 'package', + 'typealias', + 'val', + 'var', + 'fun', + 'when', + ]), + keywordOverrides: new Map([ + [TypescriptKeyword.Null, 'Null'], + [TypescriptKeyword.Object, 'Any'], + ]), + } + + override formatFieldName(name: string): string { + const escaped = name.replace(':', '_').replace('/', '_') + const isKeyword = this.options.reserved.has(escaped) + const needsBacktick = isKeyword || !/^[a-zA-Z0-9_]+$/.test(escaped) + // Replace all non-alphanumeric characters with underscores + const fieldName = this.escape(escaped, '-') + return needsBacktick ? `\`${fieldName}\`` : fieldName + } + + public mapSyntax(key: string, value: string): string { + return `Map<${key}, ${value}>` + } + + public listSyntax(value: string): string { + return `List<${value}>` + } +} diff --git a/agent/src/cli/scip-codegen/utils.ts b/agent/src/cli/scip-codegen/utils.ts index a32177379c56..5552a8a759d7 100644 --- a/agent/src/cli/scip-codegen/utils.ts +++ b/agent/src/cli/scip-codegen/utils.ts @@ -1,27 +1,34 @@ -import { TargetLanguage } from './Codegen' - -export function typescriptKeywordSyntax(language: TargetLanguage, symbol: string): string | undefined { +export function typescriptKeywordSyntax(symbol: string): TypescriptKeyword | undefined { switch (symbol) { case 'scip-typescript npm typescript . array#': - return 'List' + return TypescriptKeyword.List case 'scip-typescript npm typescript . null#': - return language === TargetLanguage.Kotlin ? 'Null' : 'Void' + return TypescriptKeyword.Null case 'scip-typescript npm typescript . string#': - return 'String' + return TypescriptKeyword.String case 'scip-typescript npm typescript . false#': case 'scip-typescript npm typescript . true#': case 'scip-typescript npm typescript . boolean#': - return 'Boolean' + return TypescriptKeyword.Boolean case 'scip-typescript npm typescript . number#': - return 'Long' + return TypescriptKeyword.Long case 'scip-typescript npm typescript . any#': case 'scip-typescript npm typescript . unknown#': - return language === TargetLanguage.Kotlin ? 'Any' : 'Object' + return TypescriptKeyword.Object default: return undefined } } +export enum TypescriptKeyword { + List = 'List', + Null = 'Null', + String = 'String', + Boolean = 'Boolean', + Long = 'Long', + Object = 'Object', +} + export function isBooleanTypeRef(symbol: string): boolean { switch (symbol) { case 'scip-typescript npm typescript . false#': @@ -40,9 +47,9 @@ export function capitalize(text: string): string { return text[0].toUpperCase() + text.slice(1) } -export function isTypescriptKeyword(language: TargetLanguage, symbol: string): boolean { +export function isTypescriptKeyword(symbol: string): boolean { return ( - typescriptKeywordSyntax(language, symbol) !== undefined && + typescriptKeywordSyntax(symbol) !== undefined && symbol !== 'scip-typescript npm typescript . array#' ) } diff --git a/agent/src/enterprise-s2.test.ts b/agent/src/enterprise-s2.test.ts index 77868375480c..c0264a45dbd5 100644 --- a/agent/src/enterprise-s2.test.ts +++ b/agent/src/enterprise-s2.test.ts @@ -43,9 +43,10 @@ describe('Enterprise - S2 (close main branch)', { timeout: 5000 }, () => { }, 10_000) it('creates an autocomplete provider using server-side model config from S2', async () => { - const { id, legacyModel, configSource } = ( - await s2EnterpriseClient.request('testing/autocomplete/providerConfig', null) - ).provider + const { id, legacyModel, configSource } = await s2EnterpriseClient.request( + 'testing/autocomplete/providerConfig', + null + ) expect({ id, legacyModel, configSource }).toMatchInlineSnapshot(` { diff --git a/lib/shared/src/auth/types.ts b/lib/shared/src/auth/types.ts index fd8fa75b4ab6..b770f282021a 100644 --- a/lib/shared/src/auth/types.ts +++ b/lib/shared/src/auth/types.ts @@ -51,21 +51,23 @@ export interface UnauthenticatedAuthStatus { } export const AUTH_STATUS_FIXTURE_AUTHED: AuthenticatedAuthStatus = { - endpoint: 'https://example.com', + // this typecast is necessary to prevent codegen from becoming too specific + endpoint: 'https://example.com' as string, authenticated: true, username: 'alice', pendingValidation: false, } export const AUTH_STATUS_FIXTURE_UNAUTHED: AuthStatus & { authenticated: false } = { - endpoint: 'https://example.com', + // this typecast is necessary to prevent codegen from becoming too specific + endpoint: 'https://example.com' as string, authenticated: false, pendingValidation: false, } export const AUTH_STATUS_FIXTURE_AUTHED_DOTCOM: AuthenticatedAuthStatus = { ...AUTH_STATUS_FIXTURE_AUTHED, - endpoint: 'https://sourcegraph.com', + endpoint: 'https://sourcegraph.com' as string, } export function isCodyProUser(authStatus: AuthStatus, sub: UserProductSubscription | null): boolean { diff --git a/vscode/src/jsonrpc/agent-protocol.ts b/vscode/src/jsonrpc/agent-protocol.ts index 570ef2d9fa73..63681e3a5651 100644 --- a/vscode/src/jsonrpc/agent-protocol.ts +++ b/vscode/src/jsonrpc/agent-protocol.ts @@ -23,7 +23,6 @@ import type { import type { ExtensionMessage, WebviewMessage } from '../chat/protocol' import type { CompletionBookkeepingEvent, CompletionItemID } from '../completions/analytics-logger' -import type { InlineCompletionItemProviderConfig } from '../completions/inline-completion-item-provider-config-singleton' import type { FixupTaskID } from '../non-stop/FixupTask' import type { CodyTaskState } from '../non-stop/state' @@ -238,7 +237,10 @@ export type ClientRequests = { 'testing/autocomplete/setCompletionVisibilityDelay': [{ delay: number }, null] // For testing purposes, returns the current autocomplete provider configuration. - 'testing/autocomplete/providerConfig': [null, InlineCompletionItemProviderConfig] + 'testing/autocomplete/providerConfig': [ + null, + { id: string; legacyModel: string; configSource: string }, + ] // Updates the extension configuration and returns the new // authentication status, which indicates whether the provided credentials are From c02c1a0be4b71cad530130fa66e4e19229b3f111 Mon Sep 17 00:00:00 2001 From: jamesmcnamara Date: Wed, 9 Oct 2024 16:48:14 -0700 Subject: [PATCH 02/10] added old C# bindings --- agent/bindings/csharp/ApiVersionId.cs | 12 + .../csharp/AttributionSearchParams.cs | 12 + .../csharp/AttributionSearchResult.cs | 14 + agent/bindings/csharp/AuthStatus.cs | 46 +++ agent/bindings/csharp/AutocompleteItem.cs | 14 + agent/bindings/csharp/AutocompleteParams.cs | 26 ++ agent/bindings/csharp/AutocompleteResult.cs | 12 + agent/bindings/csharp/CancelParams.cs | 10 + agent/bindings/csharp/ChatDeleteParams.cs | 10 + agent/bindings/csharp/ChatError.cs | 38 +++ agent/bindings/csharp/ChatExportParams.cs | 10 + agent/bindings/csharp/ChatExportResult.cs | 12 + agent/bindings/csharp/ChatModelsParams.cs | 10 + agent/bindings/csharp/ChatModelsResult.cs | 10 + .../bindings/csharp/ChatRemoteReposParams.cs | 10 + .../bindings/csharp/ChatRemoteReposResult.cs | 10 + agent/bindings/csharp/ChatRestoreParams.cs | 14 + agent/bindings/csharp/ChatSidebarNewResult.cs | 12 + agent/bindings/csharp/ChatWebNewResult.cs | 12 + agent/bindings/csharp/ClientCapabilities.cs | 48 ++++ agent/bindings/csharp/ClientInfo.cs | 24 ++ agent/bindings/csharp/ClientSideConfig.cs | 14 + .../bindings/csharp/CodeActionTriggerKind.cs | 13 + .../csharp/CodeActionsProvideParams.cs | 12 + .../csharp/CodeActionsProvideResult.cs | 10 + .../csharp/CodeActionsTriggerParams.cs | 10 + agent/bindings/csharp/CodyAgentClient.cs | 70 +++++ agent/bindings/csharp/CodyAgentServer.cs | 178 ++++++++++++ agent/bindings/csharp/CodyCommand.cs | 24 ++ agent/bindings/csharp/CodyCommandContext.cs | 26 ++ agent/bindings/csharp/CodyCommandMode.cs | 15 + agent/bindings/csharp/CodyCommandType.cs | 19 ++ .../bindings/csharp/CodyContextFilterItem.cs | 12 + agent/bindings/csharp/CodyError.cs | 14 + .../csharp/CodyLLMSiteConfiguration.cs | 24 ++ agent/bindings/csharp/CodyTaskState.cs | 25 ++ agent/bindings/csharp/CommandsCustomParams.cs | 10 + .../csharp/CompletionBookkeepingEvent.cs | 32 +++ agent/bindings/csharp/CompletionItemInfo.cs | 26 ++ agent/bindings/csharp/CompletionItemParams.cs | 10 + agent/bindings/csharp/CompletionLogID.cs | 12 + agent/bindings/csharp/Constants.cs | 94 +++++++ agent/bindings/csharp/ContextFilters.cs | 12 + agent/bindings/csharp/ContextItem.cs | 265 ++++++++++++++++++ agent/bindings/csharp/ContextItemSource.cs | 29 ++ agent/bindings/csharp/ContextParams.cs | 10 + agent/bindings/csharp/CreateFilesParams.cs | 10 + .../csharp/CurrentUserCodySubscription.cs | 18 ++ agent/bindings/csharp/CustomCommandResult.cs | 59 ++++ agent/bindings/csharp/Date.cs | 6 + agent/bindings/csharp/DebugMessage.cs | 12 + .../bindings/csharp/DefiniteWebviewOptions.cs | 22 ++ agent/bindings/csharp/DeleteFilesParams.cs | 10 + agent/bindings/csharp/DeleteOptionsParams.cs | 12 + agent/bindings/csharp/DiagnosticSeverity.cs | 17 ++ .../csharp/DiagnosticsPublishParams.cs | 10 + agent/bindings/csharp/DisabledParams.cs | 10 + .../bindings/csharp/DisplayCodeLensParams.cs | 12 + .../bindings/csharp/EditCommandsCodeParams.cs | 24 ++ agent/bindings/csharp/EditTask.cs | 22 ++ agent/bindings/csharp/EditTaskAcceptParams.cs | 10 + agent/bindings/csharp/EditTaskCancelParams.cs | 10 + .../csharp/EditTaskGetTaskDetailsParams.cs | 10 + agent/bindings/csharp/EditTaskRetryParams.cs | 26 ++ agent/bindings/csharp/EditTaskUndoParams.cs | 10 + agent/bindings/csharp/EndParams.cs | 12 + .../bindings/csharp/EnhancedContextParams.cs | 10 + .../bindings/csharp/EnvOpenExternalParams.cs | 10 + agent/bindings/csharp/Event.cs | 26 ++ agent/bindings/csharp/EventProperties.cs | 22 ++ agent/bindings/csharp/ExecuteCommandParams.cs | 12 + .../bindings/csharp/ExtensionConfiguration.cs | 36 +++ .../FeatureFlagsGetFeatureFlagParams.cs | 10 + agent/bindings/csharp/FileIdentifier.cs | 10 + agent/bindings/csharp/FixupTaskID.cs | 12 + agent/bindings/csharp/GetDocumentsParams.cs | 10 + agent/bindings/csharp/GetDocumentsResult.cs | 10 + .../bindings/csharp/GetFoldingRangeParams.cs | 12 + .../bindings/csharp/GetFoldingRangeResult.cs | 10 + .../bindings/csharp/GitCodebaseNameParams.cs | 10 + ...GraphqlGetRepoIdIfEmbeddingExistsParams.cs | 10 + .../bindings/csharp/GraphqlGetRepoIdParams.cs | 10 + .../csharp/GraphqlGetRepoIdsParams.cs | 12 + .../csharp/GraphqlGetRepoIdsResult.cs | 10 + agent/bindings/csharp/IconsParams.cs | 12 + agent/bindings/csharp/IgnoreTestParams.cs | 10 + agent/bindings/csharp/IgnoreTestResult.cs | 18 ++ agent/bindings/csharp/MemoryUsage.cs | 18 ++ agent/bindings/csharp/MentionParams.cs | 14 + agent/bindings/csharp/MessageOptions.cs | 12 + agent/bindings/csharp/Model.cs | 24 ++ agent/bindings/csharp/ModelContextWindow.cs | 14 + agent/bindings/csharp/ModelId.cs | 12 + agent/bindings/csharp/ModelRef.cs | 14 + agent/bindings/csharp/ModelTag.cs | 37 +++ agent/bindings/csharp/ModelUsage.cs | 15 + agent/bindings/csharp/NetworkRequest.cs | 14 + agent/bindings/csharp/NodeTypesParams.cs | 18 ++ .../csharp/NodeTypesWithCompletionParams.cs | 18 ++ agent/bindings/csharp/Null.cs | 4 + agent/bindings/csharp/OpenAICompatible.cs | 52 ++++ agent/bindings/csharp/OptionsParams.cs | 12 + agent/bindings/csharp/PortMappingParams.cs | 12 + agent/bindings/csharp/Position.cs | 12 + agent/bindings/csharp/ProgressCancelParams.cs | 10 + agent/bindings/csharp/ProgressEndParams.cs | 10 + agent/bindings/csharp/ProgressOptions.cs | 16 ++ agent/bindings/csharp/ProgressReportParams.cs | 14 + agent/bindings/csharp/ProgressStartParams.cs | 12 + agent/bindings/csharp/ProtocolCodeAction.cs | 22 ++ agent/bindings/csharp/ProtocolCodeLens.cs | 14 + agent/bindings/csharp/ProtocolCommand.cs | 16 ++ agent/bindings/csharp/ProtocolDiagnostic.cs | 20 ++ agent/bindings/csharp/ProtocolLocation.cs | 12 + .../ProtocolRelatedInformationDiagnostic.cs | 12 + agent/bindings/csharp/ProtocolTextDocument.cs | 22 ++ .../ProtocolTextDocumentContentChangeEvent.cs | 12 + agent/bindings/csharp/ProtocolTypeAdapters.cs | 12 + agent/bindings/csharp/ProviderId.cs | 12 + agent/bindings/csharp/Range.cs | 12 + agent/bindings/csharp/RangeData.cs | 12 + agent/bindings/csharp/RemoteRepoFetchState.cs | 24 ++ agent/bindings/csharp/RemoteRepoHasParams.cs | 10 + agent/bindings/csharp/RemoteRepoHasResult.cs | 10 + agent/bindings/csharp/RemoteRepoListParams.cs | 14 + agent/bindings/csharp/RemoteRepoListResult.cs | 16 ++ agent/bindings/csharp/RenameFile.cs | 12 + agent/bindings/csharp/RenameFilesParams.cs | 10 + agent/bindings/csharp/Repo.cs | 12 + agent/bindings/csharp/ReposParams.cs | 12 + .../csharp/SaveDialogOptionsParams.cs | 16 ++ .../bindings/csharp/SelectedCompletionInfo.cs | 12 + agent/bindings/csharp/SelectedReposParams.cs | 12 + .../csharp/SerializedChatInteraction.cs | 12 + .../bindings/csharp/SerializedChatMessage.cs | 30 ++ .../csharp/SerializedChatTranscript.cs | 18 ++ agent/bindings/csharp/ServerInfo.cs | 18 ++ agent/bindings/csharp/ShowOptionsParams.cs | 12 + .../csharp/ShowWindowMessageParams.cs | 26 ++ agent/bindings/csharp/SourceParams.cs | 12 + agent/bindings/csharp/StartParams.cs | 12 + agent/bindings/csharp/SymbolKind.cs | 15 + agent/bindings/csharp/TelemetryEvent.cs | 12 + .../csharp/TestingClosestPostDataParams.cs | 12 + .../csharp/TestingClosestPostDataResult.cs | 10 + .../csharp/TestingDiagnosticsParams.cs | 10 + .../csharp/TestingDiagnosticsResult.cs | 10 + .../TestingExportedTelemetryEventsResult.cs | 10 + .../csharp/TestingMemoryUsageResult.cs | 10 + .../csharp/TestingNetworkRequestsResult.cs | 10 + agent/bindings/csharp/TestingParams.cs | 12 + .../TestingProgressCancelationParams.cs | 10 + .../TestingProgressCancelationResult.cs | 10 + .../bindings/csharp/TestingProgressParams.cs | 10 + .../bindings/csharp/TestingProgressResult.cs | 10 + .../csharp/TestingRequestErrorsResult.cs | 10 + .../bindings/csharp/TestingTelemetryEvent.cs | 18 ++ .../csharp/TextDocumentChangeResult.cs | 10 + .../csharp/TextDocumentDidFocusParams.cs | 10 + .../csharp/TextDocumentDidSaveParams.cs | 10 + .../bindings/csharp/TextDocumentEditParams.cs | 14 + .../csharp/TextDocumentShowOptionsParams.cs | 14 + .../bindings/csharp/TextDocumentShowParams.cs | 12 + agent/bindings/csharp/TextEdit.cs | 85 ++++++ agent/bindings/csharp/TitleParams.cs | 12 + agent/bindings/csharp/UntitledTextDocument.cs | 14 + agent/bindings/csharp/Uri.cs | 20 ++ .../WebviewCreateWebviewPanelOptions.cs | 22 ++ .../csharp/WebviewCreateWebviewPanelParams.cs | 18 ++ .../csharp/WebviewDidDisposeNativeParams.cs | 10 + .../csharp/WebviewDidDisposeParams.cs | 10 + agent/bindings/csharp/WebviewDisposeParams.cs | 10 + .../csharp/WebviewNativeConfigParams.cs | 28 ++ .../WebviewPostMessageStringEncodedParams.cs | 12 + ...ebviewReceiveMessageStringEncodedParams.cs | 12 + ...ebviewRegisterWebviewViewProviderParams.cs | 12 + .../csharp/WebviewResolveWebviewViewParams.cs | 12 + agent/bindings/csharp/WebviewRevealParams.cs | 14 + agent/bindings/csharp/WebviewSetHtmlParams.cs | 12 + .../csharp/WebviewSetIconPathParams.cs | 12 + .../csharp/WebviewSetOptionsParams.cs | 12 + .../bindings/csharp/WebviewSetTitleParams.cs | 12 + .../csharp/WindowDidChangeContextParams.cs | 12 + .../csharp/WorkspaceEditEntryMetadata.cs | 16 ++ .../bindings/csharp/WorkspaceEditMetadata.cs | 10 + .../bindings/csharp/WorkspaceEditOperation.cs | 85 ++++++ agent/bindings/csharp/WorkspaceEditParams.cs | 12 + .../csharp/WorkspaceFolderDidChangeParams.cs | 10 + agent/bindings/csharp/WriteFileOptions.cs | 12 + 189 files changed, 3523 insertions(+) create mode 100644 agent/bindings/csharp/ApiVersionId.cs create mode 100644 agent/bindings/csharp/AttributionSearchParams.cs create mode 100644 agent/bindings/csharp/AttributionSearchResult.cs create mode 100644 agent/bindings/csharp/AuthStatus.cs create mode 100644 agent/bindings/csharp/AutocompleteItem.cs create mode 100644 agent/bindings/csharp/AutocompleteParams.cs create mode 100644 agent/bindings/csharp/AutocompleteResult.cs create mode 100644 agent/bindings/csharp/CancelParams.cs create mode 100644 agent/bindings/csharp/ChatDeleteParams.cs create mode 100644 agent/bindings/csharp/ChatError.cs create mode 100644 agent/bindings/csharp/ChatExportParams.cs create mode 100644 agent/bindings/csharp/ChatExportResult.cs create mode 100644 agent/bindings/csharp/ChatModelsParams.cs create mode 100644 agent/bindings/csharp/ChatModelsResult.cs create mode 100644 agent/bindings/csharp/ChatRemoteReposParams.cs create mode 100644 agent/bindings/csharp/ChatRemoteReposResult.cs create mode 100644 agent/bindings/csharp/ChatRestoreParams.cs create mode 100644 agent/bindings/csharp/ChatSidebarNewResult.cs create mode 100644 agent/bindings/csharp/ChatWebNewResult.cs create mode 100644 agent/bindings/csharp/ClientCapabilities.cs create mode 100644 agent/bindings/csharp/ClientInfo.cs create mode 100644 agent/bindings/csharp/ClientSideConfig.cs create mode 100644 agent/bindings/csharp/CodeActionTriggerKind.cs create mode 100644 agent/bindings/csharp/CodeActionsProvideParams.cs create mode 100644 agent/bindings/csharp/CodeActionsProvideResult.cs create mode 100644 agent/bindings/csharp/CodeActionsTriggerParams.cs create mode 100644 agent/bindings/csharp/CodyAgentClient.cs create mode 100644 agent/bindings/csharp/CodyAgentServer.cs create mode 100644 agent/bindings/csharp/CodyCommand.cs create mode 100644 agent/bindings/csharp/CodyCommandContext.cs create mode 100644 agent/bindings/csharp/CodyCommandMode.cs create mode 100644 agent/bindings/csharp/CodyCommandType.cs create mode 100644 agent/bindings/csharp/CodyContextFilterItem.cs create mode 100644 agent/bindings/csharp/CodyError.cs create mode 100644 agent/bindings/csharp/CodyLLMSiteConfiguration.cs create mode 100644 agent/bindings/csharp/CodyTaskState.cs create mode 100644 agent/bindings/csharp/CommandsCustomParams.cs create mode 100644 agent/bindings/csharp/CompletionBookkeepingEvent.cs create mode 100644 agent/bindings/csharp/CompletionItemInfo.cs create mode 100644 agent/bindings/csharp/CompletionItemParams.cs create mode 100644 agent/bindings/csharp/CompletionLogID.cs create mode 100644 agent/bindings/csharp/Constants.cs create mode 100644 agent/bindings/csharp/ContextFilters.cs create mode 100644 agent/bindings/csharp/ContextItem.cs create mode 100644 agent/bindings/csharp/ContextItemSource.cs create mode 100644 agent/bindings/csharp/ContextParams.cs create mode 100644 agent/bindings/csharp/CreateFilesParams.cs create mode 100644 agent/bindings/csharp/CurrentUserCodySubscription.cs create mode 100644 agent/bindings/csharp/CustomCommandResult.cs create mode 100644 agent/bindings/csharp/Date.cs create mode 100644 agent/bindings/csharp/DebugMessage.cs create mode 100644 agent/bindings/csharp/DefiniteWebviewOptions.cs create mode 100644 agent/bindings/csharp/DeleteFilesParams.cs create mode 100644 agent/bindings/csharp/DeleteOptionsParams.cs create mode 100644 agent/bindings/csharp/DiagnosticSeverity.cs create mode 100644 agent/bindings/csharp/DiagnosticsPublishParams.cs create mode 100644 agent/bindings/csharp/DisabledParams.cs create mode 100644 agent/bindings/csharp/DisplayCodeLensParams.cs create mode 100644 agent/bindings/csharp/EditCommandsCodeParams.cs create mode 100644 agent/bindings/csharp/EditTask.cs create mode 100644 agent/bindings/csharp/EditTaskAcceptParams.cs create mode 100644 agent/bindings/csharp/EditTaskCancelParams.cs create mode 100644 agent/bindings/csharp/EditTaskGetTaskDetailsParams.cs create mode 100644 agent/bindings/csharp/EditTaskRetryParams.cs create mode 100644 agent/bindings/csharp/EditTaskUndoParams.cs create mode 100644 agent/bindings/csharp/EndParams.cs create mode 100644 agent/bindings/csharp/EnhancedContextParams.cs create mode 100644 agent/bindings/csharp/EnvOpenExternalParams.cs create mode 100644 agent/bindings/csharp/Event.cs create mode 100644 agent/bindings/csharp/EventProperties.cs create mode 100644 agent/bindings/csharp/ExecuteCommandParams.cs create mode 100644 agent/bindings/csharp/ExtensionConfiguration.cs create mode 100644 agent/bindings/csharp/FeatureFlagsGetFeatureFlagParams.cs create mode 100644 agent/bindings/csharp/FileIdentifier.cs create mode 100644 agent/bindings/csharp/FixupTaskID.cs create mode 100644 agent/bindings/csharp/GetDocumentsParams.cs create mode 100644 agent/bindings/csharp/GetDocumentsResult.cs create mode 100644 agent/bindings/csharp/GetFoldingRangeParams.cs create mode 100644 agent/bindings/csharp/GetFoldingRangeResult.cs create mode 100644 agent/bindings/csharp/GitCodebaseNameParams.cs create mode 100644 agent/bindings/csharp/GraphqlGetRepoIdIfEmbeddingExistsParams.cs create mode 100644 agent/bindings/csharp/GraphqlGetRepoIdParams.cs create mode 100644 agent/bindings/csharp/GraphqlGetRepoIdsParams.cs create mode 100644 agent/bindings/csharp/GraphqlGetRepoIdsResult.cs create mode 100644 agent/bindings/csharp/IconsParams.cs create mode 100644 agent/bindings/csharp/IgnoreTestParams.cs create mode 100644 agent/bindings/csharp/IgnoreTestResult.cs create mode 100644 agent/bindings/csharp/MemoryUsage.cs create mode 100644 agent/bindings/csharp/MentionParams.cs create mode 100644 agent/bindings/csharp/MessageOptions.cs create mode 100644 agent/bindings/csharp/Model.cs create mode 100644 agent/bindings/csharp/ModelContextWindow.cs create mode 100644 agent/bindings/csharp/ModelId.cs create mode 100644 agent/bindings/csharp/ModelRef.cs create mode 100644 agent/bindings/csharp/ModelTag.cs create mode 100644 agent/bindings/csharp/ModelUsage.cs create mode 100644 agent/bindings/csharp/NetworkRequest.cs create mode 100644 agent/bindings/csharp/NodeTypesParams.cs create mode 100644 agent/bindings/csharp/NodeTypesWithCompletionParams.cs create mode 100644 agent/bindings/csharp/Null.cs create mode 100644 agent/bindings/csharp/OpenAICompatible.cs create mode 100644 agent/bindings/csharp/OptionsParams.cs create mode 100644 agent/bindings/csharp/PortMappingParams.cs create mode 100644 agent/bindings/csharp/Position.cs create mode 100644 agent/bindings/csharp/ProgressCancelParams.cs create mode 100644 agent/bindings/csharp/ProgressEndParams.cs create mode 100644 agent/bindings/csharp/ProgressOptions.cs create mode 100644 agent/bindings/csharp/ProgressReportParams.cs create mode 100644 agent/bindings/csharp/ProgressStartParams.cs create mode 100644 agent/bindings/csharp/ProtocolCodeAction.cs create mode 100644 agent/bindings/csharp/ProtocolCodeLens.cs create mode 100644 agent/bindings/csharp/ProtocolCommand.cs create mode 100644 agent/bindings/csharp/ProtocolDiagnostic.cs create mode 100644 agent/bindings/csharp/ProtocolLocation.cs create mode 100644 agent/bindings/csharp/ProtocolRelatedInformationDiagnostic.cs create mode 100644 agent/bindings/csharp/ProtocolTextDocument.cs create mode 100644 agent/bindings/csharp/ProtocolTextDocumentContentChangeEvent.cs create mode 100644 agent/bindings/csharp/ProtocolTypeAdapters.cs create mode 100644 agent/bindings/csharp/ProviderId.cs create mode 100644 agent/bindings/csharp/Range.cs create mode 100644 agent/bindings/csharp/RangeData.cs create mode 100644 agent/bindings/csharp/RemoteRepoFetchState.cs create mode 100644 agent/bindings/csharp/RemoteRepoHasParams.cs create mode 100644 agent/bindings/csharp/RemoteRepoHasResult.cs create mode 100644 agent/bindings/csharp/RemoteRepoListParams.cs create mode 100644 agent/bindings/csharp/RemoteRepoListResult.cs create mode 100644 agent/bindings/csharp/RenameFile.cs create mode 100644 agent/bindings/csharp/RenameFilesParams.cs create mode 100644 agent/bindings/csharp/Repo.cs create mode 100644 agent/bindings/csharp/ReposParams.cs create mode 100644 agent/bindings/csharp/SaveDialogOptionsParams.cs create mode 100644 agent/bindings/csharp/SelectedCompletionInfo.cs create mode 100644 agent/bindings/csharp/SelectedReposParams.cs create mode 100644 agent/bindings/csharp/SerializedChatInteraction.cs create mode 100644 agent/bindings/csharp/SerializedChatMessage.cs create mode 100644 agent/bindings/csharp/SerializedChatTranscript.cs create mode 100644 agent/bindings/csharp/ServerInfo.cs create mode 100644 agent/bindings/csharp/ShowOptionsParams.cs create mode 100644 agent/bindings/csharp/ShowWindowMessageParams.cs create mode 100644 agent/bindings/csharp/SourceParams.cs create mode 100644 agent/bindings/csharp/StartParams.cs create mode 100644 agent/bindings/csharp/SymbolKind.cs create mode 100644 agent/bindings/csharp/TelemetryEvent.cs create mode 100644 agent/bindings/csharp/TestingClosestPostDataParams.cs create mode 100644 agent/bindings/csharp/TestingClosestPostDataResult.cs create mode 100644 agent/bindings/csharp/TestingDiagnosticsParams.cs create mode 100644 agent/bindings/csharp/TestingDiagnosticsResult.cs create mode 100644 agent/bindings/csharp/TestingExportedTelemetryEventsResult.cs create mode 100644 agent/bindings/csharp/TestingMemoryUsageResult.cs create mode 100644 agent/bindings/csharp/TestingNetworkRequestsResult.cs create mode 100644 agent/bindings/csharp/TestingParams.cs create mode 100644 agent/bindings/csharp/TestingProgressCancelationParams.cs create mode 100644 agent/bindings/csharp/TestingProgressCancelationResult.cs create mode 100644 agent/bindings/csharp/TestingProgressParams.cs create mode 100644 agent/bindings/csharp/TestingProgressResult.cs create mode 100644 agent/bindings/csharp/TestingRequestErrorsResult.cs create mode 100644 agent/bindings/csharp/TestingTelemetryEvent.cs create mode 100644 agent/bindings/csharp/TextDocumentChangeResult.cs create mode 100644 agent/bindings/csharp/TextDocumentDidFocusParams.cs create mode 100644 agent/bindings/csharp/TextDocumentDidSaveParams.cs create mode 100644 agent/bindings/csharp/TextDocumentEditParams.cs create mode 100644 agent/bindings/csharp/TextDocumentShowOptionsParams.cs create mode 100644 agent/bindings/csharp/TextDocumentShowParams.cs create mode 100644 agent/bindings/csharp/TextEdit.cs create mode 100644 agent/bindings/csharp/TitleParams.cs create mode 100644 agent/bindings/csharp/UntitledTextDocument.cs create mode 100644 agent/bindings/csharp/Uri.cs create mode 100644 agent/bindings/csharp/WebviewCreateWebviewPanelOptions.cs create mode 100644 agent/bindings/csharp/WebviewCreateWebviewPanelParams.cs create mode 100644 agent/bindings/csharp/WebviewDidDisposeNativeParams.cs create mode 100644 agent/bindings/csharp/WebviewDidDisposeParams.cs create mode 100644 agent/bindings/csharp/WebviewDisposeParams.cs create mode 100644 agent/bindings/csharp/WebviewNativeConfigParams.cs create mode 100644 agent/bindings/csharp/WebviewPostMessageStringEncodedParams.cs create mode 100644 agent/bindings/csharp/WebviewReceiveMessageStringEncodedParams.cs create mode 100644 agent/bindings/csharp/WebviewRegisterWebviewViewProviderParams.cs create mode 100644 agent/bindings/csharp/WebviewResolveWebviewViewParams.cs create mode 100644 agent/bindings/csharp/WebviewRevealParams.cs create mode 100644 agent/bindings/csharp/WebviewSetHtmlParams.cs create mode 100644 agent/bindings/csharp/WebviewSetIconPathParams.cs create mode 100644 agent/bindings/csharp/WebviewSetOptionsParams.cs create mode 100644 agent/bindings/csharp/WebviewSetTitleParams.cs create mode 100644 agent/bindings/csharp/WindowDidChangeContextParams.cs create mode 100644 agent/bindings/csharp/WorkspaceEditEntryMetadata.cs create mode 100644 agent/bindings/csharp/WorkspaceEditMetadata.cs create mode 100644 agent/bindings/csharp/WorkspaceEditOperation.cs create mode 100644 agent/bindings/csharp/WorkspaceEditParams.cs create mode 100644 agent/bindings/csharp/WorkspaceFolderDidChangeParams.cs create mode 100644 agent/bindings/csharp/WriteFileOptions.cs diff --git a/agent/bindings/csharp/ApiVersionId.cs b/agent/bindings/csharp/ApiVersionId.cs new file mode 100644 index 000000000000..69d591cc9218 --- /dev/null +++ b/agent/bindings/csharp/ApiVersionId.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ApiVersionId + { + public string Value { get; set; } + + public static implicit operator string(ApiVersionId value) => value.Value; + public static implicit operator ApiVersionId(string value) => new ApiVersionId { Value = value }; + } +} diff --git a/agent/bindings/csharp/AttributionSearchParams.cs b/agent/bindings/csharp/AttributionSearchParams.cs new file mode 100644 index 000000000000..1abad0a93fbe --- /dev/null +++ b/agent/bindings/csharp/AttributionSearchParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class AttributionSearchParams + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + [JsonProperty(PropertyName = "snippet")] + public string Snippet { get; set; } + } +} diff --git a/agent/bindings/csharp/AttributionSearchResult.cs b/agent/bindings/csharp/AttributionSearchResult.cs new file mode 100644 index 000000000000..8b5eef325ea5 --- /dev/null +++ b/agent/bindings/csharp/AttributionSearchResult.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class AttributionSearchResult + { + [JsonProperty(PropertyName = "error")] + public string Error { get; set; } + [JsonProperty(PropertyName = "repoNames")] + public string[] RepoNames { get; set; } + [JsonProperty(PropertyName = "limitHit")] + public bool LimitHit { get; set; } + } +} diff --git a/agent/bindings/csharp/AuthStatus.cs b/agent/bindings/csharp/AuthStatus.cs new file mode 100644 index 000000000000..7865dc469bb3 --- /dev/null +++ b/agent/bindings/csharp/AuthStatus.cs @@ -0,0 +1,46 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class AuthStatus + { + [JsonProperty(PropertyName = "username")] + public string Username { get; set; } + [JsonProperty(PropertyName = "endpoint")] + public string Endpoint { get; set; } + [JsonProperty(PropertyName = "isDotCom")] + public bool IsDotCom { get; set; } + [JsonProperty(PropertyName = "isLoggedIn")] + public bool IsLoggedIn { get; set; } + [JsonProperty(PropertyName = "isFireworksTracingEnabled")] + public bool IsFireworksTracingEnabled { get; set; } + [JsonProperty(PropertyName = "showInvalidAccessTokenError")] + public bool ShowInvalidAccessTokenError { get; set; } + [JsonProperty(PropertyName = "authenticated")] + public bool Authenticated { get; set; } + [JsonProperty(PropertyName = "hasVerifiedEmail")] + public bool HasVerifiedEmail { get; set; } + [JsonProperty(PropertyName = "requiresVerifiedEmail")] + public bool RequiresVerifiedEmail { get; set; } + [JsonProperty(PropertyName = "siteHasCodyEnabled")] + public bool SiteHasCodyEnabled { get; set; } + [JsonProperty(PropertyName = "siteVersion")] + public string SiteVersion { get; set; } + [JsonProperty(PropertyName = "codyApiVersion")] + public int CodyApiVersion { get; set; } + [JsonProperty(PropertyName = "configOverwrites")] + public CodyLLMSiteConfiguration ConfigOverwrites { get; set; } + [JsonProperty(PropertyName = "showNetworkError")] + public bool ShowNetworkError { get; set; } + [JsonProperty(PropertyName = "primaryEmail")] + public string PrimaryEmail { get; set; } + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + [JsonProperty(PropertyName = "avatarURL")] + public string AvatarURL { get; set; } + [JsonProperty(PropertyName = "userCanUpgrade")] + public bool UserCanUpgrade { get; set; } + [JsonProperty(PropertyName = "isOfflineMode")] + public bool IsOfflineMode { get; set; } + } +} diff --git a/agent/bindings/csharp/AutocompleteItem.cs b/agent/bindings/csharp/AutocompleteItem.cs new file mode 100644 index 000000000000..3f370a2ebe9d --- /dev/null +++ b/agent/bindings/csharp/AutocompleteItem.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class AutocompleteItem + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + [JsonProperty(PropertyName = "insertText")] + public string InsertText { get; set; } + [JsonProperty(PropertyName = "range")] + public Range Range { get; set; } + } +} diff --git a/agent/bindings/csharp/AutocompleteParams.cs b/agent/bindings/csharp/AutocompleteParams.cs new file mode 100644 index 000000000000..97e0a9ba06ea --- /dev/null +++ b/agent/bindings/csharp/AutocompleteParams.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class AutocompleteParams + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "filePath")] + public string FilePath { get; set; } + [JsonProperty(PropertyName = "position")] + public Position Position { get; set; } + [JsonProperty(PropertyName = "triggerKind")] + public TriggerKindEnum TriggerKind { get; set; } // Oneof: Automatic, Invoke + [JsonProperty(PropertyName = "selectedCompletionInfo")] + public SelectedCompletionInfo SelectedCompletionInfo { get; set; } + + public enum TriggerKindEnum + { + [EnumMember(Value = "Automatic")] + Automatic, + [EnumMember(Value = "Invoke")] + Invoke, + } + } +} diff --git a/agent/bindings/csharp/AutocompleteResult.cs b/agent/bindings/csharp/AutocompleteResult.cs new file mode 100644 index 000000000000..f260d5d3e0c0 --- /dev/null +++ b/agent/bindings/csharp/AutocompleteResult.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class AutocompleteResult + { + [JsonProperty(PropertyName = "items")] + public AutocompleteItem[] Items { get; set; } + [JsonProperty(PropertyName = "completionEvent")] + public CompletionBookkeepingEvent CompletionEvent { get; set; } + } +} diff --git a/agent/bindings/csharp/CancelParams.cs b/agent/bindings/csharp/CancelParams.cs new file mode 100644 index 000000000000..8439e02167ac --- /dev/null +++ b/agent/bindings/csharp/CancelParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CancelParams + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + } +} diff --git a/agent/bindings/csharp/ChatDeleteParams.cs b/agent/bindings/csharp/ChatDeleteParams.cs new file mode 100644 index 000000000000..9fce6386afe8 --- /dev/null +++ b/agent/bindings/csharp/ChatDeleteParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ChatDeleteParams + { + [JsonProperty(PropertyName = "chatId")] + public string ChatId { get; set; } + } +} diff --git a/agent/bindings/csharp/ChatError.cs b/agent/bindings/csharp/ChatError.cs new file mode 100644 index 000000000000..a3dcea415bdc --- /dev/null +++ b/agent/bindings/csharp/ChatError.cs @@ -0,0 +1,38 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ChatError + { + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + [JsonProperty(PropertyName = "retryAfter")] + public string RetryAfter { get; set; } + [JsonProperty(PropertyName = "limit")] + public int Limit { get; set; } + [JsonProperty(PropertyName = "userMessage")] + public string UserMessage { get; set; } + [JsonProperty(PropertyName = "retryAfterDate")] + public Date RetryAfterDate { get; set; } + [JsonProperty(PropertyName = "retryAfterDateString")] + public string RetryAfterDateString { get; set; } + [JsonProperty(PropertyName = "retryMessage")] + public string RetryMessage { get; set; } + [JsonProperty(PropertyName = "feature")] + public string Feature { get; set; } + [JsonProperty(PropertyName = "upgradeIsAvailable")] + public bool UpgradeIsAvailable { get; set; } + [JsonProperty(PropertyName = "isChatErrorGuard")] + public IsChatErrorGuardEnum IsChatErrorGuard { get; set; } // Oneof: isChatErrorGuard + + public enum IsChatErrorGuardEnum + { + [EnumMember(Value = "isChatErrorGuard")] + IsChatErrorGuard, + } + } +} diff --git a/agent/bindings/csharp/ChatExportParams.cs b/agent/bindings/csharp/ChatExportParams.cs new file mode 100644 index 000000000000..62897653cff9 --- /dev/null +++ b/agent/bindings/csharp/ChatExportParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ChatExportParams + { + [JsonProperty(PropertyName = "fullHistory")] + public bool FullHistory { get; set; } + } +} diff --git a/agent/bindings/csharp/ChatExportResult.cs b/agent/bindings/csharp/ChatExportResult.cs new file mode 100644 index 000000000000..1deccfbe97ba --- /dev/null +++ b/agent/bindings/csharp/ChatExportResult.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ChatExportResult + { + [JsonProperty(PropertyName = "chatID")] + public string ChatID { get; set; } + [JsonProperty(PropertyName = "transcript")] + public SerializedChatTranscript Transcript { get; set; } + } +} diff --git a/agent/bindings/csharp/ChatModelsParams.cs b/agent/bindings/csharp/ChatModelsParams.cs new file mode 100644 index 000000000000..97ed09d1e29c --- /dev/null +++ b/agent/bindings/csharp/ChatModelsParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ChatModelsParams + { + [JsonProperty(PropertyName = "modelUsage")] + public ModelUsage ModelUsage { get; set; } // Oneof: chat, edit, autocomplete + } +} diff --git a/agent/bindings/csharp/ChatModelsResult.cs b/agent/bindings/csharp/ChatModelsResult.cs new file mode 100644 index 000000000000..065f86d3c64d --- /dev/null +++ b/agent/bindings/csharp/ChatModelsResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ChatModelsResult + { + [JsonProperty(PropertyName = "models")] + public Model[] Models { get; set; } + } +} diff --git a/agent/bindings/csharp/ChatRemoteReposParams.cs b/agent/bindings/csharp/ChatRemoteReposParams.cs new file mode 100644 index 000000000000..6719bb13f074 --- /dev/null +++ b/agent/bindings/csharp/ChatRemoteReposParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ChatRemoteReposParams + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + } +} diff --git a/agent/bindings/csharp/ChatRemoteReposResult.cs b/agent/bindings/csharp/ChatRemoteReposResult.cs new file mode 100644 index 000000000000..8f1fe6aa3d25 --- /dev/null +++ b/agent/bindings/csharp/ChatRemoteReposResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ChatRemoteReposResult + { + [JsonProperty(PropertyName = "remoteRepos")] + public Repo[] RemoteRepos { get; set; } + } +} diff --git a/agent/bindings/csharp/ChatRestoreParams.cs b/agent/bindings/csharp/ChatRestoreParams.cs new file mode 100644 index 000000000000..47f24dc8a549 --- /dev/null +++ b/agent/bindings/csharp/ChatRestoreParams.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ChatRestoreParams + { + [JsonProperty(PropertyName = "modelID")] + public string ModelID { get; set; } + [JsonProperty(PropertyName = "messages")] + public SerializedChatMessage[] Messages { get; set; } + [JsonProperty(PropertyName = "chatID")] + public string ChatID { get; set; } + } +} diff --git a/agent/bindings/csharp/ChatSidebarNewResult.cs b/agent/bindings/csharp/ChatSidebarNewResult.cs new file mode 100644 index 000000000000..e67bf8eb6cc9 --- /dev/null +++ b/agent/bindings/csharp/ChatSidebarNewResult.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ChatSidebarNewResult + { + [JsonProperty(PropertyName = "panelId")] + public string PanelId { get; set; } + [JsonProperty(PropertyName = "chatId")] + public string ChatId { get; set; } + } +} diff --git a/agent/bindings/csharp/ChatWebNewResult.cs b/agent/bindings/csharp/ChatWebNewResult.cs new file mode 100644 index 000000000000..5630dae97b95 --- /dev/null +++ b/agent/bindings/csharp/ChatWebNewResult.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ChatWebNewResult + { + [JsonProperty(PropertyName = "panelId")] + public string PanelId { get; set; } + [JsonProperty(PropertyName = "chatId")] + public string ChatId { get; set; } + } +} diff --git a/agent/bindings/csharp/ClientCapabilities.cs b/agent/bindings/csharp/ClientCapabilities.cs new file mode 100644 index 000000000000..c4f04df50ec2 --- /dev/null +++ b/agent/bindings/csharp/ClientCapabilities.cs @@ -0,0 +1,48 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ClientCapabilities + { + [JsonProperty(PropertyName = "completions")] + public CompletionsEnum Completions { get; set; } // Oneof: none + [JsonProperty(PropertyName = "chat")] + public ChatEnum Chat { get; set; } // Oneof: none, streaming + [JsonProperty(PropertyName = "git")] + public GitEnum Git { get; set; } // Oneof: none, enabled + [JsonProperty(PropertyName = "progressBars")] + public ProgressBarsEnum ProgressBars { get; set; } // Oneof: none, enabled + [JsonProperty(PropertyName = "edit")] + public EditEnum Edit { get; set; } // Oneof: none, enabled + [JsonProperty(PropertyName = "editWorkspace")] + public EditWorkspaceEnum EditWorkspace { get; set; } // Oneof: none, enabled + [JsonProperty(PropertyName = "untitledDocuments")] + public UntitledDocumentsEnum UntitledDocuments { get; set; } // Oneof: none, enabled + [JsonProperty(PropertyName = "showDocument")] + public ShowDocumentEnum ShowDocument { get; set; } // Oneof: none, enabled + [JsonProperty(PropertyName = "codeLenses")] + public CodeLensesEnum CodeLenses { get; set; } // Oneof: none, enabled + [JsonProperty(PropertyName = "showWindowMessage")] + public ShowWindowMessageEnum ShowWindowMessage { get; set; } // Oneof: notification, request + [JsonProperty(PropertyName = "ignore")] + public IgnoreEnum Ignore { get; set; } // Oneof: none, enabled + [JsonProperty(PropertyName = "codeActions")] + public CodeActionsEnum CodeActions { get; set; } // Oneof: none, enabled + [JsonProperty(PropertyName = "webviewMessages")] + public string WebviewMessages { get; set; } // Oneof: object-encoded, string-encoded + [JsonProperty(PropertyName = "globalState")] + public string GlobalState { get; set; } // Oneof: stateless, server-managed, client-managed + [JsonProperty(PropertyName = "webview")] + public WebviewEnum Webview { get; set; } // Oneof: agentic, native + [JsonProperty(PropertyName = "webviewNativeConfig")] + public WebviewNativeConfigParams WebviewNativeConfig { get; set; } + + public enum WebviewEnum + { + [EnumMember(Value = "agentic")] + Agentic, + [EnumMember(Value = "native")] + Native, + } + } +} diff --git a/agent/bindings/csharp/ClientInfo.cs b/agent/bindings/csharp/ClientInfo.cs new file mode 100644 index 000000000000..be70c1a760c2 --- /dev/null +++ b/agent/bindings/csharp/ClientInfo.cs @@ -0,0 +1,24 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ClientInfo + { + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + [JsonProperty(PropertyName = "ideVersion")] + public string IdeVersion { get; set; } + [JsonProperty(PropertyName = "workspaceRootUri")] + public string WorkspaceRootUri { get; set; } + [JsonProperty(PropertyName = "globalStateDir")] + public string GlobalStateDir { get; set; } + [JsonProperty(PropertyName = "workspaceRootPath")] + public string WorkspaceRootPath { get; set; } + [JsonProperty(PropertyName = "extensionConfiguration")] + public ExtensionConfiguration ExtensionConfiguration { get; set; } + [JsonProperty(PropertyName = "capabilities")] + public ClientCapabilities Capabilities { get; set; } + } +} diff --git a/agent/bindings/csharp/ClientSideConfig.cs b/agent/bindings/csharp/ClientSideConfig.cs new file mode 100644 index 000000000000..a6866d230332 --- /dev/null +++ b/agent/bindings/csharp/ClientSideConfig.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ClientSideConfig + { + [JsonProperty(PropertyName = "apiKey")] + public string ApiKey { get; set; } + [JsonProperty(PropertyName = "apiEndpoint")] + public string ApiEndpoint { get; set; } + [JsonProperty(PropertyName = "openAICompatible")] + public OpenAICompatible OpenAICompatible { get; set; } + } +} diff --git a/agent/bindings/csharp/CodeActionTriggerKind.cs b/agent/bindings/csharp/CodeActionTriggerKind.cs new file mode 100644 index 000000000000..b1c767dbcd3b --- /dev/null +++ b/agent/bindings/csharp/CodeActionTriggerKind.cs @@ -0,0 +1,13 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + + public enum CodeActionTriggerKind + { + [EnumMember(Value = "Invoke")] + Invoke, + [EnumMember(Value = "Automatic")] + Automatic, + } +} diff --git a/agent/bindings/csharp/CodeActionsProvideParams.cs b/agent/bindings/csharp/CodeActionsProvideParams.cs new file mode 100644 index 000000000000..dd457970645f --- /dev/null +++ b/agent/bindings/csharp/CodeActionsProvideParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CodeActionsProvideParams + { + [JsonProperty(PropertyName = "location")] + public ProtocolLocation Location { get; set; } + [JsonProperty(PropertyName = "triggerKind")] + public CodeActionTriggerKind TriggerKind { get; set; } // Oneof: Invoke, Automatic + } +} diff --git a/agent/bindings/csharp/CodeActionsProvideResult.cs b/agent/bindings/csharp/CodeActionsProvideResult.cs new file mode 100644 index 000000000000..4c92ea6974dc --- /dev/null +++ b/agent/bindings/csharp/CodeActionsProvideResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CodeActionsProvideResult + { + [JsonProperty(PropertyName = "codeActions")] + public ProtocolCodeAction[] CodeActions { get; set; } + } +} diff --git a/agent/bindings/csharp/CodeActionsTriggerParams.cs b/agent/bindings/csharp/CodeActionsTriggerParams.cs new file mode 100644 index 000000000000..ec78e031328f --- /dev/null +++ b/agent/bindings/csharp/CodeActionsTriggerParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CodeActionsTriggerParams + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + } +} diff --git a/agent/bindings/csharp/CodyAgentClient.cs b/agent/bindings/csharp/CodyAgentClient.cs new file mode 100644 index 000000000000..0aa5d7199a43 --- /dev/null +++ b/agent/bindings/csharp/CodyAgentClient.cs @@ -0,0 +1,70 @@ +using System.Threading.Tasks; + +namespace Cody.Core.Agent.Protocol; +{ + +public interface CodyAgentClient +{ + // ======== + // Requests + // ======== + [JsonRpcMethod("window/showMessage")] + Task WindowShowMessage(ShowWindowMessageParams params); + [JsonRpcMethod("window/showSaveDialog")] + Task WindowShowSaveDialog(SaveDialogOptionsParams params); + [JsonRpcMethod("textDocument/edit")] + Task TextDocumentEdit(TextDocumentEditParams params); + [JsonRpcMethod("textDocument/openUntitledDocument")] + Task TextDocumentOpenUntitledDocument(UntitledTextDocument params); + [JsonRpcMethod("textDocument/show")] + Task TextDocumentShow(TextDocumentShowParams params); + [JsonRpcMethod("workspace/edit")] + Task WorkspaceEdit(WorkspaceEditParams params); + [JsonRpcMethod("env/openExternal")] + Task EnvOpenExternal(EnvOpenExternalParams params); + + // ============= + // Notifications + // ============= + [JsonRpcMethod("debug/message")] + void DebugMessage(DebugMessage params); + [JsonRpcMethod("editTask/didUpdate")] + void EditTaskDidUpdate(EditTask params); + [JsonRpcMethod("editTask/didDelete")] + void EditTaskDidDelete(EditTask params); + [JsonRpcMethod("codeLenses/display")] + void CodeLensesDisplay(DisplayCodeLensParams params); + [JsonRpcMethod("ignore/didChange")] + void IgnoreDidChange(Void params); + [JsonRpcMethod("webview/postMessageStringEncoded")] + void WebviewPostMessageStringEncoded(WebviewPostMessageStringEncodedParams params); + [JsonRpcMethod("progress/start")] + void ProgressStart(ProgressStartParams params); + [JsonRpcMethod("progress/report")] + void ProgressReport(ProgressReportParams params); + [JsonRpcMethod("progress/end")] + void ProgressEnd(ProgressEndParams params); + [JsonRpcMethod("remoteRepo/didChange")] + void RemoteRepoDidChange(Void params); + [JsonRpcMethod("remoteRepo/didChangeState")] + void RemoteRepoDidChangeState(RemoteRepoFetchState params); + [JsonRpcMethod("webview/registerWebviewViewProvider")] + void WebviewRegisterWebviewViewProvider(WebviewRegisterWebviewViewProviderParams params); + [JsonRpcMethod("webview/createWebviewPanel")] + void WebviewCreateWebviewPanel(WebviewCreateWebviewPanelParams params); + [JsonRpcMethod("webview/dispose")] + void WebviewDispose(WebviewDisposeParams params); + [JsonRpcMethod("webview/reveal")] + void WebviewReveal(WebviewRevealParams params); + [JsonRpcMethod("webview/setTitle")] + void WebviewSetTitle(WebviewSetTitleParams params); + [JsonRpcMethod("webview/setIconPath")] + void WebviewSetIconPath(WebviewSetIconPathParams params); + [JsonRpcMethod("webview/setOptions")] + void WebviewSetOptions(WebviewSetOptionsParams params); + [JsonRpcMethod("webview/setHtml")] + void WebviewSetHtml(WebviewSetHtmlParams params); + [JsonRpcMethod("window/didChangeContext")] + void WindowDidChangeContext(WindowDidChangeContextParams params); +} +} diff --git a/agent/bindings/csharp/CodyAgentServer.cs b/agent/bindings/csharp/CodyAgentServer.cs new file mode 100644 index 000000000000..efe1cdb820d4 --- /dev/null +++ b/agent/bindings/csharp/CodyAgentServer.cs @@ -0,0 +1,178 @@ +using System.Threading.Tasks; + +namespace Cody.Core.Agent.Protocol; +{ + +public interface CodyAgentServer +{ + // ======== + // Requests + // ======== + [JsonRpcMethod("initialize")] + Task Initialize(ClientInfo params); + [JsonRpcMethod("shutdown")] + Task Shutdown(); + [JsonRpcMethod("chat/new")] + Task ChatNew(); + [JsonRpcMethod("chat/web/new")] + Task ChatWebNew(); + [JsonRpcMethod("chat/sidebar/new")] + Task ChatSidebarNew(); + [JsonRpcMethod("chat/delete")] + Task ChatDelete(ChatDeleteParams params); + [JsonRpcMethod("chat/restore")] + Task ChatRestore(ChatRestoreParams params); + [JsonRpcMethod("chat/models")] + Task ChatModels(ChatModelsParams params); + [JsonRpcMethod("chat/export")] + Task ChatExport(ChatExportParams params); + [JsonRpcMethod("chat/remoteRepos")] + Task ChatRemoteRepos(ChatRemoteReposParams params); + [JsonRpcMethod("commands/explain")] + Task CommandsExplain(); + [JsonRpcMethod("commands/test")] + Task CommandsTest(); + [JsonRpcMethod("commands/smell")] + Task CommandsSmell(); + [JsonRpcMethod("commands/custom")] + Task CommandsCustom(CommandsCustomParams params); + [JsonRpcMethod("customCommands/list")] + Task CustomCommandsList(); + [JsonRpcMethod("editCommands/code")] + Task EditCommandsCode(EditCommandsCodeParams params); + [JsonRpcMethod("editCommands/test")] + Task EditCommandsTest(); + [JsonRpcMethod("editCommands/document")] + Task EditCommandsDocument(); + [JsonRpcMethod("editTask/accept")] + Task EditTaskAccept(EditTaskAcceptParams params); + [JsonRpcMethod("editTask/undo")] + Task EditTaskUndo(EditTaskUndoParams params); + [JsonRpcMethod("editTask/cancel")] + Task EditTaskCancel(EditTaskCancelParams params); + [JsonRpcMethod("editTask/retry")] + Task EditTaskRetry(EditTaskRetryParams params); + [JsonRpcMethod("editTask/getTaskDetails")] + Task EditTaskGetTaskDetails(EditTaskGetTaskDetailsParams params); + [JsonRpcMethod("editTask/getFoldingRanges")] + Task EditTaskGetFoldingRanges(GetFoldingRangeParams params); + [JsonRpcMethod("command/execute")] + Task CommandExecute(ExecuteCommandParams params); + [JsonRpcMethod("codeActions/provide")] + Task CodeActionsProvide(CodeActionsProvideParams params); + [JsonRpcMethod("codeActions/trigger")] + Task CodeActionsTrigger(CodeActionsTriggerParams params); + [JsonRpcMethod("autocomplete/execute")] + Task AutocompleteExecute(AutocompleteParams params); + [JsonRpcMethod("graphql/getRepoIds")] + Task GraphqlGetRepoIds(GraphqlGetRepoIdsParams params); + [JsonRpcMethod("graphql/currentUserId")] + Task GraphqlCurrentUserId(); + [JsonRpcMethod("graphql/currentUserIsPro")] + Task GraphqlCurrentUserIsPro(); + [JsonRpcMethod("featureFlags/getFeatureFlag")] + Task FeatureFlagsGetFeatureFlag(FeatureFlagsGetFeatureFlagParams params); + [JsonRpcMethod("graphql/getCurrentUserCodySubscription")] + Task GraphqlGetCurrentUserCodySubscription(); + [JsonRpcMethod("graphql/logEvent")] + Task GraphqlLogEvent(Event params); + [JsonRpcMethod("telemetry/recordEvent")] + Task TelemetryRecordEvent(TelemetryEvent params); + [JsonRpcMethod("graphql/getRepoIdIfEmbeddingExists")] + Task GraphqlGetRepoIdIfEmbeddingExists(GraphqlGetRepoIdIfEmbeddingExistsParams params); + [JsonRpcMethod("graphql/getRepoId")] + Task GraphqlGetRepoId(GraphqlGetRepoIdParams params); + [JsonRpcMethod("git/codebaseName")] + Task GitCodebaseName(GitCodebaseNameParams params); + [JsonRpcMethod("webview/didDispose")] + Task WebviewDidDispose(WebviewDidDisposeParams params); + [JsonRpcMethod("webview/resolveWebviewView")] + Task WebviewResolveWebviewView(WebviewResolveWebviewViewParams params); + [JsonRpcMethod("webview/receiveMessageStringEncoded")] + Task WebviewReceiveMessageStringEncoded(WebviewReceiveMessageStringEncodedParams params); + [JsonRpcMethod("diagnostics/publish")] + Task DiagnosticsPublish(DiagnosticsPublishParams params); + [JsonRpcMethod("testing/progress")] + Task TestingProgress(TestingProgressParams params); + [JsonRpcMethod("testing/exportedTelemetryEvents")] + Task TestingExportedTelemetryEvents(); + [JsonRpcMethod("testing/networkRequests")] + Task TestingNetworkRequests(); + [JsonRpcMethod("testing/requestErrors")] + Task TestingRequestErrors(); + [JsonRpcMethod("testing/closestPostData")] + Task TestingClosestPostData(TestingClosestPostDataParams params); + [JsonRpcMethod("testing/memoryUsage")] + Task TestingMemoryUsage(); + [JsonRpcMethod("testing/awaitPendingPromises")] + Task TestingAwaitPendingPromises(); + [JsonRpcMethod("testing/workspaceDocuments")] + Task TestingWorkspaceDocuments(GetDocumentsParams params); + [JsonRpcMethod("testing/diagnostics")] + Task TestingDiagnostics(TestingDiagnosticsParams params); + [JsonRpcMethod("testing/progressCancelation")] + Task TestingProgressCancelation(TestingProgressCancelationParams params); + [JsonRpcMethod("testing/reset")] + Task TestingReset(); + [JsonRpcMethod("testing/autocomplete/completionEvent")] + Task TestingAutocompleteCompletionEvent(CompletionItemParams params); + [JsonRpcMethod("extensionConfiguration/change")] + Task ExtensionConfigurationChange(ExtensionConfiguration params); + [JsonRpcMethod("extensionConfiguration/status")] + Task ExtensionConfigurationStatus(); + [JsonRpcMethod("extensionConfiguration/getSettingsSchema")] + Task ExtensionConfigurationGetSettingsSchema(); + [JsonRpcMethod("textDocument/change")] + Task TextDocumentChange(ProtocolTextDocument params); + [JsonRpcMethod("attribution/search")] + Task AttributionSearch(AttributionSearchParams params); + [JsonRpcMethod("ignore/test")] + Task IgnoreTest(IgnoreTestParams params); + [JsonRpcMethod("testing/ignore/overridePolicy")] + Task TestingIgnoreOverridePolicy(ContextFilters params); + [JsonRpcMethod("remoteRepo/has")] + Task RemoteRepoHas(RemoteRepoHasParams params); + [JsonRpcMethod("remoteRepo/list")] + Task RemoteRepoList(RemoteRepoListParams params); + + // ============= + // Notifications + // ============= + [JsonRpcMethod("initialized")] + void Initialized(Void params); + [JsonRpcMethod("exit")] + void Exit(Void params); + [JsonRpcMethod("extensionConfiguration/didChange")] + void ExtensionConfigurationDidChange(ExtensionConfiguration params); + [JsonRpcMethod("workspaceFolder/didChange")] + void WorkspaceFolderDidChange(WorkspaceFolderDidChangeParams params); + [JsonRpcMethod("textDocument/didOpen")] + void TextDocumentDidOpen(ProtocolTextDocument params); + [JsonRpcMethod("textDocument/didChange")] + void TextDocumentDidChange(ProtocolTextDocument params); + [JsonRpcMethod("textDocument/didFocus")] + void TextDocumentDidFocus(TextDocumentDidFocusParams params); + [JsonRpcMethod("textDocument/didSave")] + void TextDocumentDidSave(TextDocumentDidSaveParams params); + [JsonRpcMethod("textDocument/didClose")] + void TextDocumentDidClose(ProtocolTextDocument params); + [JsonRpcMethod("workspace/didDeleteFiles")] + void WorkspaceDidDeleteFiles(DeleteFilesParams params); + [JsonRpcMethod("workspace/didCreateFiles")] + void WorkspaceDidCreateFiles(CreateFilesParams params); + [JsonRpcMethod("workspace/didRenameFiles")] + void WorkspaceDidRenameFiles(RenameFilesParams params); + [JsonRpcMethod("$/cancelRequest")] + void CancelRequest(CancelParams params); + [JsonRpcMethod("autocomplete/clearLastCandidate")] + void AutocompleteClearLastCandidate(Void params); + [JsonRpcMethod("autocomplete/completionSuggested")] + void AutocompleteCompletionSuggested(CompletionItemParams params); + [JsonRpcMethod("autocomplete/completionAccepted")] + void AutocompleteCompletionAccepted(CompletionItemParams params); + [JsonRpcMethod("progress/cancel")] + void ProgressCancel(ProgressCancelParams params); + [JsonRpcMethod("webview/didDisposeNative")] + void WebviewDidDisposeNative(WebviewDidDisposeNativeParams params); +} +} diff --git a/agent/bindings/csharp/CodyCommand.cs b/agent/bindings/csharp/CodyCommand.cs new file mode 100644 index 000000000000..90893fb0c13d --- /dev/null +++ b/agent/bindings/csharp/CodyCommand.cs @@ -0,0 +1,24 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CodyCommand + { + [JsonProperty(PropertyName = "slashCommand")] + public string SlashCommand { get; set; } + [JsonProperty(PropertyName = "key")] + public string Key { get; set; } + [JsonProperty(PropertyName = "prompt")] + public string Prompt { get; set; } + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + [JsonProperty(PropertyName = "context")] + public CodyCommandContext Context { get; set; } + [JsonProperty(PropertyName = "type")] + public CodyCommandType Type { get; set; } // Oneof: workspace, user, default, experimental, recently used + [JsonProperty(PropertyName = "mode")] + public CodyCommandMode Mode { get; set; } // Oneof: ask, edit, insert + [JsonProperty(PropertyName = "requestID")] + public string RequestID { get; set; } + } +} diff --git a/agent/bindings/csharp/CodyCommandContext.cs b/agent/bindings/csharp/CodyCommandContext.cs new file mode 100644 index 000000000000..d01f31f0fec8 --- /dev/null +++ b/agent/bindings/csharp/CodyCommandContext.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CodyCommandContext + { + [JsonProperty(PropertyName = "none")] + public bool None { get; set; } + [JsonProperty(PropertyName = "openTabs")] + public bool OpenTabs { get; set; } + [JsonProperty(PropertyName = "currentDir")] + public bool CurrentDir { get; set; } + [JsonProperty(PropertyName = "currentFile")] + public bool CurrentFile { get; set; } + [JsonProperty(PropertyName = "selection")] + public bool Selection { get; set; } + [JsonProperty(PropertyName = "command")] + public string Command { get; set; } + [JsonProperty(PropertyName = "filePath")] + public string FilePath { get; set; } + [JsonProperty(PropertyName = "directoryPath")] + public string DirectoryPath { get; set; } + [JsonProperty(PropertyName = "codebase")] + public bool Codebase { get; set; } + } +} diff --git a/agent/bindings/csharp/CodyCommandMode.cs b/agent/bindings/csharp/CodyCommandMode.cs new file mode 100644 index 000000000000..7c9432cfdcf7 --- /dev/null +++ b/agent/bindings/csharp/CodyCommandMode.cs @@ -0,0 +1,15 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + + public enum CodyCommandMode + { + [EnumMember(Value = "ask")] + Ask, + [EnumMember(Value = "edit")] + Edit, + [EnumMember(Value = "insert")] + Insert, + } +} diff --git a/agent/bindings/csharp/CodyCommandType.cs b/agent/bindings/csharp/CodyCommandType.cs new file mode 100644 index 000000000000..6fdeb2de894b --- /dev/null +++ b/agent/bindings/csharp/CodyCommandType.cs @@ -0,0 +1,19 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + + public enum CodyCommandType + { + [EnumMember(Value = "workspace")] + Workspace, + [EnumMember(Value = "user")] + User, + [EnumMember(Value = "default")] + Default, + [EnumMember(Value = "experimental")] + Experimental, + [EnumMember(Value = "recently used")] + Recently used, + } +} diff --git a/agent/bindings/csharp/CodyContextFilterItem.cs b/agent/bindings/csharp/CodyContextFilterItem.cs new file mode 100644 index 000000000000..f538fc97e04e --- /dev/null +++ b/agent/bindings/csharp/CodyContextFilterItem.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CodyContextFilterItem + { + [JsonProperty(PropertyName = "repoNamePattern")] + public string RepoNamePattern { get; set; } + [JsonProperty(PropertyName = "filePathPatterns")] + public string[] FilePathPatterns { get; set; } + } +} diff --git a/agent/bindings/csharp/CodyError.cs b/agent/bindings/csharp/CodyError.cs new file mode 100644 index 000000000000..e36cb6487f86 --- /dev/null +++ b/agent/bindings/csharp/CodyError.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CodyError + { + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + [JsonProperty(PropertyName = "cause")] + public CodyError Cause { get; set; } + [JsonProperty(PropertyName = "stack")] + public string Stack { get; set; } + } +} diff --git a/agent/bindings/csharp/CodyLLMSiteConfiguration.cs b/agent/bindings/csharp/CodyLLMSiteConfiguration.cs new file mode 100644 index 000000000000..e7cc963ef858 --- /dev/null +++ b/agent/bindings/csharp/CodyLLMSiteConfiguration.cs @@ -0,0 +1,24 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CodyLLMSiteConfiguration + { + [JsonProperty(PropertyName = "chatModel")] + public string ChatModel { get; set; } + [JsonProperty(PropertyName = "chatModelMaxTokens")] + public int ChatModelMaxTokens { get; set; } + [JsonProperty(PropertyName = "fastChatModel")] + public string FastChatModel { get; set; } + [JsonProperty(PropertyName = "fastChatModelMaxTokens")] + public int FastChatModelMaxTokens { get; set; } + [JsonProperty(PropertyName = "completionModel")] + public string CompletionModel { get; set; } + [JsonProperty(PropertyName = "completionModelMaxTokens")] + public int CompletionModelMaxTokens { get; set; } + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + [JsonProperty(PropertyName = "smartContextWindow")] + public bool SmartContextWindow { get; set; } + } +} diff --git a/agent/bindings/csharp/CodyTaskState.cs b/agent/bindings/csharp/CodyTaskState.cs new file mode 100644 index 000000000000..12f3ef333a4f --- /dev/null +++ b/agent/bindings/csharp/CodyTaskState.cs @@ -0,0 +1,25 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + + public enum CodyTaskState + { + [EnumMember(Value = "Idle")] + Idle, + [EnumMember(Value = "Working")] + Working, + [EnumMember(Value = "Inserting")] + Inserting, + [EnumMember(Value = "Applying")] + Applying, + [EnumMember(Value = "Applied")] + Applied, + [EnumMember(Value = "Finished")] + Finished, + [EnumMember(Value = "Error")] + Error, + [EnumMember(Value = "Pending")] + Pending, + } +} diff --git a/agent/bindings/csharp/CommandsCustomParams.cs b/agent/bindings/csharp/CommandsCustomParams.cs new file mode 100644 index 000000000000..1a165865cb36 --- /dev/null +++ b/agent/bindings/csharp/CommandsCustomParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CommandsCustomParams + { + [JsonProperty(PropertyName = "key")] + public string Key { get; set; } + } +} diff --git a/agent/bindings/csharp/CompletionBookkeepingEvent.cs b/agent/bindings/csharp/CompletionBookkeepingEvent.cs new file mode 100644 index 000000000000..96b4666b4771 --- /dev/null +++ b/agent/bindings/csharp/CompletionBookkeepingEvent.cs @@ -0,0 +1,32 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CompletionBookkeepingEvent + { + [JsonProperty(PropertyName = "id")] + public CompletionLogID Id { get; set; } + [JsonProperty(PropertyName = "startedAt")] + public int StartedAt { get; set; } + [JsonProperty(PropertyName = "networkRequestStartedAt")] + public int NetworkRequestStartedAt { get; set; } + [JsonProperty(PropertyName = "startLoggedAt")] + public int StartLoggedAt { get; set; } + [JsonProperty(PropertyName = "loadedAt")] + public int LoadedAt { get; set; } + [JsonProperty(PropertyName = "suggestedAt")] + public int SuggestedAt { get; set; } + [JsonProperty(PropertyName = "suggestionLoggedAt")] + public int SuggestionLoggedAt { get; set; } + [JsonProperty(PropertyName = "suggestionAnalyticsLoggedAt")] + public int SuggestionAnalyticsLoggedAt { get; set; } + [JsonProperty(PropertyName = "acceptedAt")] + public int AcceptedAt { get; set; } + [JsonProperty(PropertyName = "items")] + public CompletionItemInfo[] Items { get; set; } + [JsonProperty(PropertyName = "loggedPartialAcceptedLength")] + public int LoggedPartialAcceptedLength { get; set; } + [JsonProperty(PropertyName = "read")] + public bool Read { get; set; } + } +} diff --git a/agent/bindings/csharp/CompletionItemInfo.cs b/agent/bindings/csharp/CompletionItemInfo.cs new file mode 100644 index 000000000000..04e663875f42 --- /dev/null +++ b/agent/bindings/csharp/CompletionItemInfo.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CompletionItemInfo + { + [JsonProperty(PropertyName = "parseErrorCount")] + public int ParseErrorCount { get; set; } + [JsonProperty(PropertyName = "lineTruncatedCount")] + public int LineTruncatedCount { get; set; } + [JsonProperty(PropertyName = "truncatedWith")] + public string TruncatedWith { get; set; } // Oneof: tree-sitter, indentation + [JsonProperty(PropertyName = "nodeTypes")] + public NodeTypesParams NodeTypes { get; set; } + [JsonProperty(PropertyName = "nodeTypesWithCompletion")] + public NodeTypesWithCompletionParams NodeTypesWithCompletion { get; set; } + [JsonProperty(PropertyName = "lineCount")] + public int LineCount { get; set; } + [JsonProperty(PropertyName = "charCount")] + public int CharCount { get; set; } + [JsonProperty(PropertyName = "insertText")] + public string InsertText { get; set; } + [JsonProperty(PropertyName = "stopReason")] + public string StopReason { get; set; } + } +} diff --git a/agent/bindings/csharp/CompletionItemParams.cs b/agent/bindings/csharp/CompletionItemParams.cs new file mode 100644 index 000000000000..97cbd337cddc --- /dev/null +++ b/agent/bindings/csharp/CompletionItemParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CompletionItemParams + { + [JsonProperty(PropertyName = "completionID")] + public string CompletionID { get; set; } + } +} diff --git a/agent/bindings/csharp/CompletionLogID.cs b/agent/bindings/csharp/CompletionLogID.cs new file mode 100644 index 000000000000..c24bf439eea1 --- /dev/null +++ b/agent/bindings/csharp/CompletionLogID.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CompletionLogID + { + public string Value { get; set; } + + public static implicit operator string(CompletionLogID value) => value.Value; + public static implicit operator CompletionLogID(string value) => new CompletionLogID { Value = value }; + } +} diff --git a/agent/bindings/csharp/Constants.cs b/agent/bindings/csharp/Constants.cs new file mode 100644 index 000000000000..a147979ef255 --- /dev/null +++ b/agent/bindings/csharp/Constants.cs @@ -0,0 +1,94 @@ +namespace Cody.Core.Agent.Protocol; +{ +public static class Constants +{ + public const string Applied = "Applied"; + public const string Applying = "Applying"; + public const string Automatic = "Automatic"; + public const string Error = "Error"; + public const string Finished = "Finished"; + public const string IDEEXTENSION = "IDEEXTENSION"; + public const string Idle = "Idle"; + public const string Inserting = "Inserting"; + public const string Invoke = "Invoke"; + public const string Pending = "Pending"; + public const string Working = "Working"; + public const string Agentic = "agentic"; + public const string Ask = "ask"; + public const string Assistant = "assistant"; + public const string Autocomplete = "autocomplete"; + public const string Balanced = "balanced"; + public const string Byok = "byok"; + public const string Chat = "chat"; + public const string Class = "class"; + public const string Client-managed = "client-managed"; + public const string Complete = "complete"; + public const string Create-file = "create-file"; + public const string Default = "default"; + public const string Delete = "delete"; + public const string Delete-file = "delete-file"; + public const string Deprecated = "deprecated"; + public const string Dev = "dev"; + public const string Edit = "edit"; + public const string Edit-file = "edit-file"; + public const string Editor = "editor"; + public const string Embeddings = "embeddings"; + public const string Enabled = "enabled"; + public const string Enterprise = "enterprise"; + public const string Error = "error"; + public const string Errored = "errored"; + public const string Experimental = "experimental"; + public const string Fetching = "fetching"; + public const string File = "file"; + public const string Free = "free"; + public const string Function = "function"; + public const string Gateway = "gateway"; + public const string History = "history"; + public const string Human = "human"; + public const string Ignore = "ignore"; + public const string Indentation = "indentation"; + public const string Info = "info"; + public const string Information = "information"; + public const string Initial = "initial"; + public const string Insert = "insert"; + public const string IsChatErrorGuard = "isChatErrorGuard"; + public const string Local = "local"; + public const string Method = "method"; + public const string Multiple = "multiple"; + public const string Native = "native"; + public const string None = "none"; + public const string Notification = "notification"; + public const string Object-encoded = "object-encoded"; + public const string Ollama = "ollama"; + public const string Openctx = "openctx"; + public const string Paused = "paused"; + public const string Power = "power"; + public const string Pro = "pro"; + public const string Recently used = "recently used"; + public const string Recommended = "recommended"; + public const string Rename-file = "rename-file"; + public const string Replace = "replace"; + public const string Repository = "repository"; + public const string Request = "request"; + public const string Search = "search"; + public const string Selection = "selection"; + public const string Server-managed = "server-managed"; + public const string Single = "single"; + public const string Speed = "speed"; + public const string Stateless = "stateless"; + public const string Streaming = "streaming"; + public const string String-encoded = "string-encoded"; + public const string Suggestion = "suggestion"; + public const string Symbol = "symbol"; + public const string System = "system"; + public const string Terminal = "terminal"; + public const string Tree = "tree"; + public const string Tree-sitter = "tree-sitter"; + public const string Unified = "unified"; + public const string Uri = "uri"; + public const string Use = "use"; + public const string User = "user"; + public const string Warning = "warning"; + public const string Workspace = "workspace"; +} +} diff --git a/agent/bindings/csharp/ContextFilters.cs b/agent/bindings/csharp/ContextFilters.cs new file mode 100644 index 000000000000..b87b895c1d7a --- /dev/null +++ b/agent/bindings/csharp/ContextFilters.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ContextFilters + { + [JsonProperty(PropertyName = "include")] + public CodyContextFilterItem[] Include { get; set; } + [JsonProperty(PropertyName = "exclude")] + public CodyContextFilterItem[] Exclude { get; set; } + } +} diff --git a/agent/bindings/csharp/ContextItem.cs b/agent/bindings/csharp/ContextItem.cs new file mode 100644 index 000000000000..aee8746c3a35 --- /dev/null +++ b/agent/bindings/csharp/ContextItem.cs @@ -0,0 +1,265 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + + [JsonConverter(typeof(ContextItemConverter))] + public abstract class ContextItem + { + private class ContextItemConverter : JsonConverter + { + public override ContextItem Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var jsonDoc = JsonDocument.ParseValue(ref reader); + var discriminator = jsonDoc.RootElement.GetProperty("type").GetString(); + switch (discriminator) + { + case "file": + return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); + case "repository": + return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); + case "tree": + return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); + case "symbol": + return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); + case "openctx": + return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); + default: + throw new JsonException($"Unknown discriminator {discriminator}"); + } + } + public override void Write(Utf8JsonWriter writer, ${name} value, JsonSerializerOptions options) + { + JsonSerializer.Serialize(writer, value, value.GetType(), options); + } + } + + public class ContextItemFile : ContextItem + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "range")] + public RangeData Range { get; set; } + [JsonProperty(PropertyName = "content")] + public string Content { get; set; } + [JsonProperty(PropertyName = "repoName")] + public string RepoName { get; set; } + [JsonProperty(PropertyName = "revision")] + public string Revision { get; set; } + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + [JsonProperty(PropertyName = "source")] + public ContextItemSource Source { get; set; } // Oneof: embeddings, user, editor, search, initial, unified, selection, terminal, uri, history + [JsonProperty(PropertyName = "size")] + public int Size { get; set; } + [JsonProperty(PropertyName = "isIgnored")] + public bool IsIgnored { get; set; } + [JsonProperty(PropertyName = "isTooLarge")] + public bool IsTooLarge { get; set; } + [JsonProperty(PropertyName = "isTooLargeReason")] + public string IsTooLargeReason { get; set; } + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + [JsonProperty(PropertyName = "icon")] + public string Icon { get; set; } + [JsonProperty(PropertyName = "metadata")] + public string[] Metadata { get; set; } + [JsonProperty(PropertyName = "type")] + public TypeEnum Type { get; set; } // Oneof: file + [JsonProperty(PropertyName = "remoteRepositoryName")] + public string RemoteRepositoryName { get; set; } + + public enum TypeEnum + { + [EnumMember(Value = "file")] + File, + } + } + + public class ContextItemRepository : ContextItem + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "range")] + public RangeData Range { get; set; } + [JsonProperty(PropertyName = "content")] + public string Content { get; set; } + [JsonProperty(PropertyName = "repoName")] + public string RepoName { get; set; } + [JsonProperty(PropertyName = "revision")] + public string Revision { get; set; } + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + [JsonProperty(PropertyName = "source")] + public ContextItemSource Source { get; set; } // Oneof: embeddings, user, editor, search, initial, unified, selection, terminal, uri, history + [JsonProperty(PropertyName = "size")] + public int Size { get; set; } + [JsonProperty(PropertyName = "isIgnored")] + public bool IsIgnored { get; set; } + [JsonProperty(PropertyName = "isTooLarge")] + public bool IsTooLarge { get; set; } + [JsonProperty(PropertyName = "isTooLargeReason")] + public string IsTooLargeReason { get; set; } + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + [JsonProperty(PropertyName = "icon")] + public string Icon { get; set; } + [JsonProperty(PropertyName = "metadata")] + public string[] Metadata { get; set; } + [JsonProperty(PropertyName = "type")] + public TypeEnum Type { get; set; } // Oneof: repository + [JsonProperty(PropertyName = "repoID")] + public string RepoID { get; set; } + + public enum TypeEnum + { + [EnumMember(Value = "repository")] + Repository, + } + } + + public class ContextItemTree : ContextItem + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "range")] + public RangeData Range { get; set; } + [JsonProperty(PropertyName = "content")] + public string Content { get; set; } + [JsonProperty(PropertyName = "repoName")] + public string RepoName { get; set; } + [JsonProperty(PropertyName = "revision")] + public string Revision { get; set; } + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + [JsonProperty(PropertyName = "source")] + public ContextItemSource Source { get; set; } // Oneof: embeddings, user, editor, search, initial, unified, selection, terminal, uri, history + [JsonProperty(PropertyName = "size")] + public int Size { get; set; } + [JsonProperty(PropertyName = "isIgnored")] + public bool IsIgnored { get; set; } + [JsonProperty(PropertyName = "isTooLarge")] + public bool IsTooLarge { get; set; } + [JsonProperty(PropertyName = "isTooLargeReason")] + public string IsTooLargeReason { get; set; } + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + [JsonProperty(PropertyName = "icon")] + public string Icon { get; set; } + [JsonProperty(PropertyName = "metadata")] + public string[] Metadata { get; set; } + [JsonProperty(PropertyName = "type")] + public TypeEnum Type { get; set; } // Oneof: tree + [JsonProperty(PropertyName = "isWorkspaceRoot")] + public bool IsWorkspaceRoot { get; set; } + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + public enum TypeEnum + { + [EnumMember(Value = "tree")] + Tree, + } + } + + public class ContextItemSymbol : ContextItem + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "range")] + public RangeData Range { get; set; } + [JsonProperty(PropertyName = "content")] + public string Content { get; set; } + [JsonProperty(PropertyName = "repoName")] + public string RepoName { get; set; } + [JsonProperty(PropertyName = "revision")] + public string Revision { get; set; } + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + [JsonProperty(PropertyName = "source")] + public ContextItemSource Source { get; set; } // Oneof: embeddings, user, editor, search, initial, unified, selection, terminal, uri, history + [JsonProperty(PropertyName = "size")] + public int Size { get; set; } + [JsonProperty(PropertyName = "isIgnored")] + public bool IsIgnored { get; set; } + [JsonProperty(PropertyName = "isTooLarge")] + public bool IsTooLarge { get; set; } + [JsonProperty(PropertyName = "isTooLargeReason")] + public string IsTooLargeReason { get; set; } + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + [JsonProperty(PropertyName = "icon")] + public string Icon { get; set; } + [JsonProperty(PropertyName = "metadata")] + public string[] Metadata { get; set; } + [JsonProperty(PropertyName = "type")] + public TypeEnum Type { get; set; } // Oneof: symbol + [JsonProperty(PropertyName = "symbolName")] + public string SymbolName { get; set; } + [JsonProperty(PropertyName = "kind")] + public SymbolKind Kind { get; set; } // Oneof: class, function, method + [JsonProperty(PropertyName = "remoteRepositoryName")] + public string RemoteRepositoryName { get; set; } + + public enum TypeEnum + { + [EnumMember(Value = "symbol")] + Symbol, + } + } + + public class ContextItemOpenCtx : ContextItem + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "range")] + public RangeData Range { get; set; } + [JsonProperty(PropertyName = "content")] + public string Content { get; set; } + [JsonProperty(PropertyName = "repoName")] + public string RepoName { get; set; } + [JsonProperty(PropertyName = "revision")] + public string Revision { get; set; } + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + [JsonProperty(PropertyName = "source")] + public ContextItemSource Source { get; set; } // Oneof: embeddings, user, editor, search, initial, unified, selection, terminal, uri, history + [JsonProperty(PropertyName = "size")] + public int Size { get; set; } + [JsonProperty(PropertyName = "isIgnored")] + public bool IsIgnored { get; set; } + [JsonProperty(PropertyName = "isTooLarge")] + public bool IsTooLarge { get; set; } + [JsonProperty(PropertyName = "isTooLargeReason")] + public string IsTooLargeReason { get; set; } + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + [JsonProperty(PropertyName = "icon")] + public string Icon { get; set; } + [JsonProperty(PropertyName = "metadata")] + public string[] Metadata { get; set; } + [JsonProperty(PropertyName = "type")] + public TypeEnum Type { get; set; } // Oneof: openctx + [JsonProperty(PropertyName = "providerUri")] + public string ProviderUri { get; set; } + [JsonProperty(PropertyName = "mention")] + public MentionParams Mention { get; set; } + + public enum TypeEnum + { + [EnumMember(Value = "openctx")] + Openctx, + } + } + } +} diff --git a/agent/bindings/csharp/ContextItemSource.cs b/agent/bindings/csharp/ContextItemSource.cs new file mode 100644 index 000000000000..09cac57e6117 --- /dev/null +++ b/agent/bindings/csharp/ContextItemSource.cs @@ -0,0 +1,29 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + + public enum ContextItemSource + { + [EnumMember(Value = "embeddings")] + Embeddings, + [EnumMember(Value = "user")] + User, + [EnumMember(Value = "editor")] + Editor, + [EnumMember(Value = "search")] + Search, + [EnumMember(Value = "initial")] + Initial, + [EnumMember(Value = "unified")] + Unified, + [EnumMember(Value = "selection")] + Selection, + [EnumMember(Value = "terminal")] + Terminal, + [EnumMember(Value = "uri")] + Uri, + [EnumMember(Value = "history")] + History, + } +} diff --git a/agent/bindings/csharp/ContextParams.cs b/agent/bindings/csharp/ContextParams.cs new file mode 100644 index 000000000000..e7e2b6e8394a --- /dev/null +++ b/agent/bindings/csharp/ContextParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ContextParams + { + [JsonProperty(PropertyName = "user")] + public int User { get; set; } + } +} diff --git a/agent/bindings/csharp/CreateFilesParams.cs b/agent/bindings/csharp/CreateFilesParams.cs new file mode 100644 index 000000000000..d6813ec9af36 --- /dev/null +++ b/agent/bindings/csharp/CreateFilesParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CreateFilesParams + { + [JsonProperty(PropertyName = "files")] + public FileIdentifier[] Files { get; set; } + } +} diff --git a/agent/bindings/csharp/CurrentUserCodySubscription.cs b/agent/bindings/csharp/CurrentUserCodySubscription.cs new file mode 100644 index 000000000000..70da363c0b77 --- /dev/null +++ b/agent/bindings/csharp/CurrentUserCodySubscription.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class CurrentUserCodySubscription + { + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + [JsonProperty(PropertyName = "plan")] + public string Plan { get; set; } + [JsonProperty(PropertyName = "applyProRateLimits")] + public bool ApplyProRateLimits { get; set; } + [JsonProperty(PropertyName = "currentPeriodStartAt")] + public Date CurrentPeriodStartAt { get; set; } + [JsonProperty(PropertyName = "currentPeriodEndAt")] + public Date CurrentPeriodEndAt { get; set; } + } +} diff --git a/agent/bindings/csharp/CustomCommandResult.cs b/agent/bindings/csharp/CustomCommandResult.cs new file mode 100644 index 000000000000..5942d919e50e --- /dev/null +++ b/agent/bindings/csharp/CustomCommandResult.cs @@ -0,0 +1,59 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + + [JsonConverter(typeof(CustomCommandResultConverter))] + public abstract class CustomCommandResult + { + private class CustomCommandResultConverter : JsonConverter + { + public override CustomCommandResult Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var jsonDoc = JsonDocument.ParseValue(ref reader); + var discriminator = jsonDoc.RootElement.GetProperty("type").GetString(); + switch (discriminator) + { + case "chat": + return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); + case "edit": + return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); + default: + throw new JsonException($"Unknown discriminator {discriminator}"); + } + } + public override void Write(Utf8JsonWriter writer, ${name} value, JsonSerializerOptions options) + { + JsonSerializer.Serialize(writer, value, value.GetType(), options); + } + } + + public class CustomChatCommandResult : CustomCommandResult + { + [JsonProperty(PropertyName = "type")] + public TypeEnum Type { get; set; } // Oneof: chat + [JsonProperty(PropertyName = "chatResult")] + public string ChatResult { get; set; } + + public enum TypeEnum + { + [EnumMember(Value = "chat")] + Chat, + } + } + + public class CustomEditCommandResult : CustomCommandResult + { + [JsonProperty(PropertyName = "type")] + public TypeEnum Type { get; set; } // Oneof: edit + [JsonProperty(PropertyName = "editResult")] + public EditTask EditResult { get; set; } + + public enum TypeEnum + { + [EnumMember(Value = "edit")] + Edit, + } + } + } +} diff --git a/agent/bindings/csharp/Date.cs b/agent/bindings/csharp/Date.cs new file mode 100644 index 000000000000..45df115e2d37 --- /dev/null +++ b/agent/bindings/csharp/Date.cs @@ -0,0 +1,6 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class Date : String { } +} diff --git a/agent/bindings/csharp/DebugMessage.cs b/agent/bindings/csharp/DebugMessage.cs new file mode 100644 index 000000000000..512596d4b60e --- /dev/null +++ b/agent/bindings/csharp/DebugMessage.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class DebugMessage + { + [JsonProperty(PropertyName = "channel")] + public string Channel { get; set; } + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + } +} diff --git a/agent/bindings/csharp/DefiniteWebviewOptions.cs b/agent/bindings/csharp/DefiniteWebviewOptions.cs new file mode 100644 index 000000000000..397a2874b95a --- /dev/null +++ b/agent/bindings/csharp/DefiniteWebviewOptions.cs @@ -0,0 +1,22 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class DefiniteWebviewOptions + { + [JsonProperty(PropertyName = "enableScripts")] + public bool EnableScripts { get; set; } + [JsonProperty(PropertyName = "enableForms")] + public bool EnableForms { get; set; } + [JsonProperty(PropertyName = "enableOnlyCommandUris")] + public string[] EnableOnlyCommandUris { get; set; } + [JsonProperty(PropertyName = "localResourceRoots")] + public string[] LocalResourceRoots { get; set; } + [JsonProperty(PropertyName = "portMapping")] + public PortMappingParams[] PortMapping { get; set; } + [JsonProperty(PropertyName = "enableFindWidget")] + public bool EnableFindWidget { get; set; } + [JsonProperty(PropertyName = "retainContextWhenHidden")] + public bool RetainContextWhenHidden { get; set; } + } +} diff --git a/agent/bindings/csharp/DeleteFilesParams.cs b/agent/bindings/csharp/DeleteFilesParams.cs new file mode 100644 index 000000000000..dac7889cd5d6 --- /dev/null +++ b/agent/bindings/csharp/DeleteFilesParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class DeleteFilesParams + { + [JsonProperty(PropertyName = "files")] + public FileIdentifier[] Files { get; set; } + } +} diff --git a/agent/bindings/csharp/DeleteOptionsParams.cs b/agent/bindings/csharp/DeleteOptionsParams.cs new file mode 100644 index 000000000000..50972f74d985 --- /dev/null +++ b/agent/bindings/csharp/DeleteOptionsParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class DeleteOptionsParams + { + [JsonProperty(PropertyName = "recursive")] + public bool Recursive { get; set; } + [JsonProperty(PropertyName = "ignoreIfNotExists")] + public bool IgnoreIfNotExists { get; set; } + } +} diff --git a/agent/bindings/csharp/DiagnosticSeverity.cs b/agent/bindings/csharp/DiagnosticSeverity.cs new file mode 100644 index 000000000000..2c81ecdc778b --- /dev/null +++ b/agent/bindings/csharp/DiagnosticSeverity.cs @@ -0,0 +1,17 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + + public enum DiagnosticSeverity + { + [EnumMember(Value = "error")] + Error, + [EnumMember(Value = "warning")] + Warning, + [EnumMember(Value = "info")] + Info, + [EnumMember(Value = "suggestion")] + Suggestion, + } +} diff --git a/agent/bindings/csharp/DiagnosticsPublishParams.cs b/agent/bindings/csharp/DiagnosticsPublishParams.cs new file mode 100644 index 000000000000..76d5bba7a5fd --- /dev/null +++ b/agent/bindings/csharp/DiagnosticsPublishParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class DiagnosticsPublishParams + { + [JsonProperty(PropertyName = "diagnostics")] + public ProtocolDiagnostic[] Diagnostics { get; set; } + } +} diff --git a/agent/bindings/csharp/DisabledParams.cs b/agent/bindings/csharp/DisabledParams.cs new file mode 100644 index 000000000000..b69794e63a41 --- /dev/null +++ b/agent/bindings/csharp/DisabledParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class DisabledParams + { + [JsonProperty(PropertyName = "reason")] + public string Reason { get; set; } + } +} diff --git a/agent/bindings/csharp/DisplayCodeLensParams.cs b/agent/bindings/csharp/DisplayCodeLensParams.cs new file mode 100644 index 000000000000..2dd2ead6fb12 --- /dev/null +++ b/agent/bindings/csharp/DisplayCodeLensParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class DisplayCodeLensParams + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "codeLenses")] + public ProtocolCodeLens[] CodeLenses { get; set; } + } +} diff --git a/agent/bindings/csharp/EditCommandsCodeParams.cs b/agent/bindings/csharp/EditCommandsCodeParams.cs new file mode 100644 index 000000000000..a4c749b92a91 --- /dev/null +++ b/agent/bindings/csharp/EditCommandsCodeParams.cs @@ -0,0 +1,24 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class EditCommandsCodeParams + { + [JsonProperty(PropertyName = "instruction")] + public string Instruction { get; set; } + [JsonProperty(PropertyName = "model")] + public string Model { get; set; } + [JsonProperty(PropertyName = "mode")] + public ModeEnum Mode { get; set; } // Oneof: edit, insert + [JsonProperty(PropertyName = "range")] + public Range Range { get; set; } + + public enum ModeEnum + { + [EnumMember(Value = "edit")] + Edit, + [EnumMember(Value = "insert")] + Insert, + } + } +} diff --git a/agent/bindings/csharp/EditTask.cs b/agent/bindings/csharp/EditTask.cs new file mode 100644 index 000000000000..d9f3286cbfb1 --- /dev/null +++ b/agent/bindings/csharp/EditTask.cs @@ -0,0 +1,22 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class EditTask + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + [JsonProperty(PropertyName = "state")] + public CodyTaskState State { get; set; } // Oneof: Idle, Working, Inserting, Applying, Applied, Finished, Error, Pending + [JsonProperty(PropertyName = "error")] + public CodyError Error { get; set; } + [JsonProperty(PropertyName = "selectionRange")] + public Range SelectionRange { get; set; } + [JsonProperty(PropertyName = "instruction")] + public string Instruction { get; set; } + [JsonProperty(PropertyName = "model")] + public string Model { get; set; } + [JsonProperty(PropertyName = "originalText")] + public string OriginalText { get; set; } + } +} diff --git a/agent/bindings/csharp/EditTaskAcceptParams.cs b/agent/bindings/csharp/EditTaskAcceptParams.cs new file mode 100644 index 000000000000..fc91303fb6f2 --- /dev/null +++ b/agent/bindings/csharp/EditTaskAcceptParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class EditTaskAcceptParams + { + [JsonProperty(PropertyName = "id")] + public FixupTaskID Id { get; set; } + } +} diff --git a/agent/bindings/csharp/EditTaskCancelParams.cs b/agent/bindings/csharp/EditTaskCancelParams.cs new file mode 100644 index 000000000000..d0cfd47f49e6 --- /dev/null +++ b/agent/bindings/csharp/EditTaskCancelParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class EditTaskCancelParams + { + [JsonProperty(PropertyName = "id")] + public FixupTaskID Id { get; set; } + } +} diff --git a/agent/bindings/csharp/EditTaskGetTaskDetailsParams.cs b/agent/bindings/csharp/EditTaskGetTaskDetailsParams.cs new file mode 100644 index 000000000000..4471474bd550 --- /dev/null +++ b/agent/bindings/csharp/EditTaskGetTaskDetailsParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class EditTaskGetTaskDetailsParams + { + [JsonProperty(PropertyName = "id")] + public FixupTaskID Id { get; set; } + } +} diff --git a/agent/bindings/csharp/EditTaskRetryParams.cs b/agent/bindings/csharp/EditTaskRetryParams.cs new file mode 100644 index 000000000000..34696551e2a6 --- /dev/null +++ b/agent/bindings/csharp/EditTaskRetryParams.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class EditTaskRetryParams + { + [JsonProperty(PropertyName = "id")] + public FixupTaskID Id { get; set; } + [JsonProperty(PropertyName = "instruction")] + public string Instruction { get; set; } + [JsonProperty(PropertyName = "model")] + public string Model { get; set; } + [JsonProperty(PropertyName = "mode")] + public ModeEnum Mode { get; set; } // Oneof: edit, insert + [JsonProperty(PropertyName = "range")] + public Range Range { get; set; } + + public enum ModeEnum + { + [EnumMember(Value = "edit")] + Edit, + [EnumMember(Value = "insert")] + Insert, + } + } +} diff --git a/agent/bindings/csharp/EditTaskUndoParams.cs b/agent/bindings/csharp/EditTaskUndoParams.cs new file mode 100644 index 000000000000..b8eeca201111 --- /dev/null +++ b/agent/bindings/csharp/EditTaskUndoParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class EditTaskUndoParams + { + [JsonProperty(PropertyName = "id")] + public FixupTaskID Id { get; set; } + } +} diff --git a/agent/bindings/csharp/EndParams.cs b/agent/bindings/csharp/EndParams.cs new file mode 100644 index 000000000000..a1e7d2a40a4c --- /dev/null +++ b/agent/bindings/csharp/EndParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class EndParams + { + [JsonProperty(PropertyName = "line")] + public int Line { get; set; } + [JsonProperty(PropertyName = "character")] + public int Character { get; set; } + } +} diff --git a/agent/bindings/csharp/EnhancedContextParams.cs b/agent/bindings/csharp/EnhancedContextParams.cs new file mode 100644 index 000000000000..49eee1477731 --- /dev/null +++ b/agent/bindings/csharp/EnhancedContextParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class EnhancedContextParams + { + [JsonProperty(PropertyName = "selectedRepos")] + public SelectedReposParams[] SelectedRepos { get; set; } + } +} diff --git a/agent/bindings/csharp/EnvOpenExternalParams.cs b/agent/bindings/csharp/EnvOpenExternalParams.cs new file mode 100644 index 000000000000..e8beec0b3978 --- /dev/null +++ b/agent/bindings/csharp/EnvOpenExternalParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class EnvOpenExternalParams + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + } +} diff --git a/agent/bindings/csharp/Event.cs b/agent/bindings/csharp/Event.cs new file mode 100644 index 000000000000..17d67e7c12a3 --- /dev/null +++ b/agent/bindings/csharp/Event.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class Event + { + [JsonProperty(PropertyName = "event")] + public string Event { get; set; } + [JsonProperty(PropertyName = "userCookieID")] + public string UserCookieID { get; set; } + [JsonProperty(PropertyName = "url")] + public string Url { get; set; } + [JsonProperty(PropertyName = "source")] + public string Source { get; set; } + [JsonProperty(PropertyName = "argument")] + public string Argument { get; set; } + [JsonProperty(PropertyName = "publicArgument")] + public string PublicArgument { get; set; } + [JsonProperty(PropertyName = "client")] + public string Client { get; set; } + [JsonProperty(PropertyName = "connectedSiteID")] + public string ConnectedSiteID { get; set; } + [JsonProperty(PropertyName = "hashedLicenseKey")] + public string HashedLicenseKey { get; set; } + } +} diff --git a/agent/bindings/csharp/EventProperties.cs b/agent/bindings/csharp/EventProperties.cs new file mode 100644 index 000000000000..857c52c6b5f8 --- /dev/null +++ b/agent/bindings/csharp/EventProperties.cs @@ -0,0 +1,22 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class EventProperties + { + [JsonProperty(PropertyName = "anonymousUserID")] + public string AnonymousUserID { get; set; } + [JsonProperty(PropertyName = "prefix")] + public string Prefix { get; set; } + [JsonProperty(PropertyName = "client")] + public string Client { get; set; } + [JsonProperty(PropertyName = "source")] + public SourceEnum Source { get; set; } // Oneof: IDEEXTENSION + + public enum SourceEnum + { + [EnumMember(Value = "IDEEXTENSION")] + IDEEXTENSION, + } + } +} diff --git a/agent/bindings/csharp/ExecuteCommandParams.cs b/agent/bindings/csharp/ExecuteCommandParams.cs new file mode 100644 index 000000000000..672075c25fb2 --- /dev/null +++ b/agent/bindings/csharp/ExecuteCommandParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ExecuteCommandParams + { + [JsonProperty(PropertyName = "command")] + public string Command { get; set; } + [JsonProperty(PropertyName = "arguments")] + public Object[] Arguments { get; set; } + } +} diff --git a/agent/bindings/csharp/ExtensionConfiguration.cs b/agent/bindings/csharp/ExtensionConfiguration.cs new file mode 100644 index 000000000000..2b5c8ccb69dc --- /dev/null +++ b/agent/bindings/csharp/ExtensionConfiguration.cs @@ -0,0 +1,36 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ExtensionConfiguration + { + [JsonProperty(PropertyName = "serverEndpoint")] + public string ServerEndpoint { get; set; } + [JsonProperty(PropertyName = "proxy")] + public string Proxy { get; set; } + [JsonProperty(PropertyName = "accessToken")] + public string AccessToken { get; set; } + [JsonProperty(PropertyName = "customHeaders")] + public Dictionary CustomHeaders { get; set; } + [JsonProperty(PropertyName = "anonymousUserID")] + public string AnonymousUserID { get; set; } + [JsonProperty(PropertyName = "autocompleteAdvancedProvider")] + public string AutocompleteAdvancedProvider { get; set; } + [JsonProperty(PropertyName = "autocompleteAdvancedModel")] + public string AutocompleteAdvancedModel { get; set; } + [JsonProperty(PropertyName = "debug")] + public bool Debug { get; set; } + [JsonProperty(PropertyName = "verboseDebug")] + public bool VerboseDebug { get; set; } + [JsonProperty(PropertyName = "telemetryClientName")] + public string TelemetryClientName { get; set; } + [JsonProperty(PropertyName = "codebase")] + public string Codebase { get; set; } + [JsonProperty(PropertyName = "eventProperties")] + public EventProperties EventProperties { get; set; } + [JsonProperty(PropertyName = "customConfiguration")] + public Dictionary CustomConfiguration { get; set; } + [JsonProperty(PropertyName = "baseGlobalState")] + public Dictionary BaseGlobalState { get; set; } + } +} diff --git a/agent/bindings/csharp/FeatureFlagsGetFeatureFlagParams.cs b/agent/bindings/csharp/FeatureFlagsGetFeatureFlagParams.cs new file mode 100644 index 000000000000..1f086f11eb42 --- /dev/null +++ b/agent/bindings/csharp/FeatureFlagsGetFeatureFlagParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class FeatureFlagsGetFeatureFlagParams + { + [JsonProperty(PropertyName = "flagName")] + public string FlagName { get; set; } + } +} diff --git a/agent/bindings/csharp/FileIdentifier.cs b/agent/bindings/csharp/FileIdentifier.cs new file mode 100644 index 000000000000..3b042feb2914 --- /dev/null +++ b/agent/bindings/csharp/FileIdentifier.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class FileIdentifier + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + } +} diff --git a/agent/bindings/csharp/FixupTaskID.cs b/agent/bindings/csharp/FixupTaskID.cs new file mode 100644 index 000000000000..b869c75f7cf2 --- /dev/null +++ b/agent/bindings/csharp/FixupTaskID.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class FixupTaskID + { + public string Value { get; set; } + + public static implicit operator string(FixupTaskID value) => value.Value; + public static implicit operator FixupTaskID(string value) => new FixupTaskID { Value = value }; + } +} diff --git a/agent/bindings/csharp/GetDocumentsParams.cs b/agent/bindings/csharp/GetDocumentsParams.cs new file mode 100644 index 000000000000..403cdbb42c92 --- /dev/null +++ b/agent/bindings/csharp/GetDocumentsParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class GetDocumentsParams + { + [JsonProperty(PropertyName = "uris")] + public string[] Uris { get; set; } + } +} diff --git a/agent/bindings/csharp/GetDocumentsResult.cs b/agent/bindings/csharp/GetDocumentsResult.cs new file mode 100644 index 000000000000..9e0f500f3a63 --- /dev/null +++ b/agent/bindings/csharp/GetDocumentsResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class GetDocumentsResult + { + [JsonProperty(PropertyName = "documents")] + public ProtocolTextDocument[] Documents { get; set; } + } +} diff --git a/agent/bindings/csharp/GetFoldingRangeParams.cs b/agent/bindings/csharp/GetFoldingRangeParams.cs new file mode 100644 index 000000000000..f939616e756a --- /dev/null +++ b/agent/bindings/csharp/GetFoldingRangeParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class GetFoldingRangeParams + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "range")] + public Range Range { get; set; } + } +} diff --git a/agent/bindings/csharp/GetFoldingRangeResult.cs b/agent/bindings/csharp/GetFoldingRangeResult.cs new file mode 100644 index 000000000000..a60bcec50b5e --- /dev/null +++ b/agent/bindings/csharp/GetFoldingRangeResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class GetFoldingRangeResult + { + [JsonProperty(PropertyName = "range")] + public Range Range { get; set; } + } +} diff --git a/agent/bindings/csharp/GitCodebaseNameParams.cs b/agent/bindings/csharp/GitCodebaseNameParams.cs new file mode 100644 index 000000000000..8861445eaeeb --- /dev/null +++ b/agent/bindings/csharp/GitCodebaseNameParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class GitCodebaseNameParams + { + [JsonProperty(PropertyName = "url")] + public string Url { get; set; } + } +} diff --git a/agent/bindings/csharp/GraphqlGetRepoIdIfEmbeddingExistsParams.cs b/agent/bindings/csharp/GraphqlGetRepoIdIfEmbeddingExistsParams.cs new file mode 100644 index 000000000000..736e2266953f --- /dev/null +++ b/agent/bindings/csharp/GraphqlGetRepoIdIfEmbeddingExistsParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class GraphqlGetRepoIdIfEmbeddingExistsParams + { + [JsonProperty(PropertyName = "repoName")] + public string RepoName { get; set; } + } +} diff --git a/agent/bindings/csharp/GraphqlGetRepoIdParams.cs b/agent/bindings/csharp/GraphqlGetRepoIdParams.cs new file mode 100644 index 000000000000..de473e21a8f5 --- /dev/null +++ b/agent/bindings/csharp/GraphqlGetRepoIdParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class GraphqlGetRepoIdParams + { + [JsonProperty(PropertyName = "repoName")] + public string RepoName { get; set; } + } +} diff --git a/agent/bindings/csharp/GraphqlGetRepoIdsParams.cs b/agent/bindings/csharp/GraphqlGetRepoIdsParams.cs new file mode 100644 index 000000000000..9cca46b4e0e1 --- /dev/null +++ b/agent/bindings/csharp/GraphqlGetRepoIdsParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class GraphqlGetRepoIdsParams + { + [JsonProperty(PropertyName = "names")] + public string[] Names { get; set; } + [JsonProperty(PropertyName = "first")] + public int First { get; set; } + } +} diff --git a/agent/bindings/csharp/GraphqlGetRepoIdsResult.cs b/agent/bindings/csharp/GraphqlGetRepoIdsResult.cs new file mode 100644 index 000000000000..a9db17163e8a --- /dev/null +++ b/agent/bindings/csharp/GraphqlGetRepoIdsResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class GraphqlGetRepoIdsResult + { + [JsonProperty(PropertyName = "repos")] + public ReposParams[] Repos { get; set; } + } +} diff --git a/agent/bindings/csharp/IconsParams.cs b/agent/bindings/csharp/IconsParams.cs new file mode 100644 index 000000000000..44da1b011955 --- /dev/null +++ b/agent/bindings/csharp/IconsParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class IconsParams + { + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + [JsonProperty(PropertyName = "position")] + public int Position { get; set; } + } +} diff --git a/agent/bindings/csharp/IgnoreTestParams.cs b/agent/bindings/csharp/IgnoreTestParams.cs new file mode 100644 index 000000000000..89a94f7fe5e1 --- /dev/null +++ b/agent/bindings/csharp/IgnoreTestParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class IgnoreTestParams + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + } +} diff --git a/agent/bindings/csharp/IgnoreTestResult.cs b/agent/bindings/csharp/IgnoreTestResult.cs new file mode 100644 index 000000000000..c39e080903fe --- /dev/null +++ b/agent/bindings/csharp/IgnoreTestResult.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class IgnoreTestResult + { + [JsonProperty(PropertyName = "policy")] + public PolicyEnum Policy { get; set; } // Oneof: ignore, use + + public enum PolicyEnum + { + [EnumMember(Value = "ignore")] + Ignore, + [EnumMember(Value = "use")] + Use, + } + } +} diff --git a/agent/bindings/csharp/MemoryUsage.cs b/agent/bindings/csharp/MemoryUsage.cs new file mode 100644 index 000000000000..7f7a44e8e70d --- /dev/null +++ b/agent/bindings/csharp/MemoryUsage.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class MemoryUsage + { + [JsonProperty(PropertyName = "rss")] + public int Rss { get; set; } + [JsonProperty(PropertyName = "heapTotal")] + public int HeapTotal { get; set; } + [JsonProperty(PropertyName = "heapUsed")] + public int HeapUsed { get; set; } + [JsonProperty(PropertyName = "external")] + public int External { get; set; } + [JsonProperty(PropertyName = "arrayBuffers")] + public int ArrayBuffers { get; set; } + } +} diff --git a/agent/bindings/csharp/MentionParams.cs b/agent/bindings/csharp/MentionParams.cs new file mode 100644 index 000000000000..d5cb0cac0da4 --- /dev/null +++ b/agent/bindings/csharp/MentionParams.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class MentionParams + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "data")] + public Object Data { get; set; } + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + } +} diff --git a/agent/bindings/csharp/MessageOptions.cs b/agent/bindings/csharp/MessageOptions.cs new file mode 100644 index 000000000000..e916629656ec --- /dev/null +++ b/agent/bindings/csharp/MessageOptions.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class MessageOptions + { + [JsonProperty(PropertyName = "modal")] + public bool Modal { get; set; } + [JsonProperty(PropertyName = "detail")] + public string Detail { get; set; } + } +} diff --git a/agent/bindings/csharp/Model.cs b/agent/bindings/csharp/Model.cs new file mode 100644 index 000000000000..5beac6c08027 --- /dev/null +++ b/agent/bindings/csharp/Model.cs @@ -0,0 +1,24 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class Model + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + [JsonProperty(PropertyName = "usage")] + public ModelUsage[] Usage { get; set; } + [JsonProperty(PropertyName = "contextWindow")] + public ModelContextWindow ContextWindow { get; set; } + [JsonProperty(PropertyName = "clientSideConfig")] + public ClientSideConfig ClientSideConfig { get; set; } + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + [JsonProperty(PropertyName = "tags")] + public ModelTag[] Tags { get; set; } + [JsonProperty(PropertyName = "modelRef")] + public ModelRef ModelRef { get; set; } + } +} diff --git a/agent/bindings/csharp/ModelContextWindow.cs b/agent/bindings/csharp/ModelContextWindow.cs new file mode 100644 index 000000000000..32efcac0dcf8 --- /dev/null +++ b/agent/bindings/csharp/ModelContextWindow.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ModelContextWindow + { + [JsonProperty(PropertyName = "input")] + public int Input { get; set; } + [JsonProperty(PropertyName = "output")] + public int Output { get; set; } + [JsonProperty(PropertyName = "context")] + public ContextParams Context { get; set; } + } +} diff --git a/agent/bindings/csharp/ModelId.cs b/agent/bindings/csharp/ModelId.cs new file mode 100644 index 000000000000..cd39fcaf94ae --- /dev/null +++ b/agent/bindings/csharp/ModelId.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ModelId + { + public string Value { get; set; } + + public static implicit operator string(ModelId value) => value.Value; + public static implicit operator ModelId(string value) => new ModelId { Value = value }; + } +} diff --git a/agent/bindings/csharp/ModelRef.cs b/agent/bindings/csharp/ModelRef.cs new file mode 100644 index 000000000000..053099fd3fde --- /dev/null +++ b/agent/bindings/csharp/ModelRef.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ModelRef + { + [JsonProperty(PropertyName = "providerId")] + public ProviderId ProviderId { get; set; } + [JsonProperty(PropertyName = "apiVersionId")] + public ApiVersionId ApiVersionId { get; set; } + [JsonProperty(PropertyName = "modelId")] + public ModelId ModelId { get; set; } + } +} diff --git a/agent/bindings/csharp/ModelTag.cs b/agent/bindings/csharp/ModelTag.cs new file mode 100644 index 000000000000..6a15a993938f --- /dev/null +++ b/agent/bindings/csharp/ModelTag.cs @@ -0,0 +1,37 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + + public enum ModelTag + { + [EnumMember(Value = "power")] + Power, + [EnumMember(Value = "speed")] + Speed, + [EnumMember(Value = "balanced")] + Balanced, + [EnumMember(Value = "recommended")] + Recommended, + [EnumMember(Value = "deprecated")] + Deprecated, + [EnumMember(Value = "experimental")] + Experimental, + [EnumMember(Value = "pro")] + Pro, + [EnumMember(Value = "free")] + Free, + [EnumMember(Value = "enterprise")] + Enterprise, + [EnumMember(Value = "gateway")] + Gateway, + [EnumMember(Value = "byok")] + Byok, + [EnumMember(Value = "local")] + Local, + [EnumMember(Value = "ollama")] + Ollama, + [EnumMember(Value = "dev")] + Dev, + } +} diff --git a/agent/bindings/csharp/ModelUsage.cs b/agent/bindings/csharp/ModelUsage.cs new file mode 100644 index 000000000000..66f764f1f306 --- /dev/null +++ b/agent/bindings/csharp/ModelUsage.cs @@ -0,0 +1,15 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + + public enum ModelUsage + { + [EnumMember(Value = "chat")] + Chat, + [EnumMember(Value = "edit")] + Edit, + [EnumMember(Value = "autocomplete")] + Autocomplete, + } +} diff --git a/agent/bindings/csharp/NetworkRequest.cs b/agent/bindings/csharp/NetworkRequest.cs new file mode 100644 index 000000000000..61cab79fee63 --- /dev/null +++ b/agent/bindings/csharp/NetworkRequest.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class NetworkRequest + { + [JsonProperty(PropertyName = "url")] + public string Url { get; set; } + [JsonProperty(PropertyName = "body")] + public string Body { get; set; } + [JsonProperty(PropertyName = "error")] + public string Error { get; set; } + } +} diff --git a/agent/bindings/csharp/NodeTypesParams.cs b/agent/bindings/csharp/NodeTypesParams.cs new file mode 100644 index 000000000000..4f12195067a3 --- /dev/null +++ b/agent/bindings/csharp/NodeTypesParams.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class NodeTypesParams + { + [JsonProperty(PropertyName = "atCursor")] + public string AtCursor { get; set; } + [JsonProperty(PropertyName = "parent")] + public string Parent { get; set; } + [JsonProperty(PropertyName = "grandparent")] + public string Grandparent { get; set; } + [JsonProperty(PropertyName = "greatGrandparent")] + public string GreatGrandparent { get; set; } + [JsonProperty(PropertyName = "lastAncestorOnTheSameLine")] + public string LastAncestorOnTheSameLine { get; set; } + } +} diff --git a/agent/bindings/csharp/NodeTypesWithCompletionParams.cs b/agent/bindings/csharp/NodeTypesWithCompletionParams.cs new file mode 100644 index 000000000000..135487daade4 --- /dev/null +++ b/agent/bindings/csharp/NodeTypesWithCompletionParams.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class NodeTypesWithCompletionParams + { + [JsonProperty(PropertyName = "atCursor")] + public string AtCursor { get; set; } + [JsonProperty(PropertyName = "parent")] + public string Parent { get; set; } + [JsonProperty(PropertyName = "grandparent")] + public string Grandparent { get; set; } + [JsonProperty(PropertyName = "greatGrandparent")] + public string GreatGrandparent { get; set; } + [JsonProperty(PropertyName = "lastAncestorOnTheSameLine")] + public string LastAncestorOnTheSameLine { get; set; } + } +} diff --git a/agent/bindings/csharp/Null.cs b/agent/bindings/csharp/Null.cs new file mode 100644 index 000000000000..7e6731d9f588 --- /dev/null +++ b/agent/bindings/csharp/Null.cs @@ -0,0 +1,4 @@ +namespace Cody.Core.Agent.Protocol; +{ + public sealed class Null {} +} diff --git a/agent/bindings/csharp/OpenAICompatible.cs b/agent/bindings/csharp/OpenAICompatible.cs new file mode 100644 index 000000000000..560d018c4350 --- /dev/null +++ b/agent/bindings/csharp/OpenAICompatible.cs @@ -0,0 +1,52 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class OpenAICompatible + { + [JsonProperty(PropertyName = "stopSequences")] + public string[] StopSequences { get; set; } + [JsonProperty(PropertyName = "endOfText")] + public string EndOfText { get; set; } + [JsonProperty(PropertyName = "contextSizeHintTotalCharacters")] + public int ContextSizeHintTotalCharacters { get; set; } + [JsonProperty(PropertyName = "contextSizeHintPrefixCharacters")] + public int ContextSizeHintPrefixCharacters { get; set; } + [JsonProperty(PropertyName = "contextSizeHintSuffixCharacters")] + public int ContextSizeHintSuffixCharacters { get; set; } + [JsonProperty(PropertyName = "chatPreInstruction")] + public string ChatPreInstruction { get; set; } + [JsonProperty(PropertyName = "editPostInstruction")] + public string EditPostInstruction { get; set; } + [JsonProperty(PropertyName = "autocompleteSinglelineTimeout")] + public int AutocompleteSinglelineTimeout { get; set; } + [JsonProperty(PropertyName = "autocompleteMultilineTimeout")] + public int AutocompleteMultilineTimeout { get; set; } + [JsonProperty(PropertyName = "chatTopK")] + public int ChatTopK { get; set; } + [JsonProperty(PropertyName = "chatTopP")] + public int ChatTopP { get; set; } + [JsonProperty(PropertyName = "chatTemperature")] + public int ChatTemperature { get; set; } + [JsonProperty(PropertyName = "chatMaxTokens")] + public int ChatMaxTokens { get; set; } + [JsonProperty(PropertyName = "autoCompleteTopK")] + public int AutoCompleteTopK { get; set; } + [JsonProperty(PropertyName = "autoCompleteTopP")] + public int AutoCompleteTopP { get; set; } + [JsonProperty(PropertyName = "autoCompleteTemperature")] + public int AutoCompleteTemperature { get; set; } + [JsonProperty(PropertyName = "autoCompleteSinglelineMaxTokens")] + public int AutoCompleteSinglelineMaxTokens { get; set; } + [JsonProperty(PropertyName = "autoCompleteMultilineMaxTokens")] + public int AutoCompleteMultilineMaxTokens { get; set; } + [JsonProperty(PropertyName = "editTopK")] + public int EditTopK { get; set; } + [JsonProperty(PropertyName = "editTopP")] + public int EditTopP { get; set; } + [JsonProperty(PropertyName = "editTemperature")] + public int EditTemperature { get; set; } + [JsonProperty(PropertyName = "editMaxTokens")] + public int EditMaxTokens { get; set; } + } +} diff --git a/agent/bindings/csharp/OptionsParams.cs b/agent/bindings/csharp/OptionsParams.cs new file mode 100644 index 000000000000..7b4d302c95c3 --- /dev/null +++ b/agent/bindings/csharp/OptionsParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class OptionsParams + { + [JsonProperty(PropertyName = "undoStopBefore")] + public bool UndoStopBefore { get; set; } + [JsonProperty(PropertyName = "undoStopAfter")] + public bool UndoStopAfter { get; set; } + } +} diff --git a/agent/bindings/csharp/PortMappingParams.cs b/agent/bindings/csharp/PortMappingParams.cs new file mode 100644 index 000000000000..fc8a09312a15 --- /dev/null +++ b/agent/bindings/csharp/PortMappingParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class PortMappingParams + { + [JsonProperty(PropertyName = "webviewPort")] + public int WebviewPort { get; set; } + [JsonProperty(PropertyName = "extensionHostPort")] + public int ExtensionHostPort { get; set; } + } +} diff --git a/agent/bindings/csharp/Position.cs b/agent/bindings/csharp/Position.cs new file mode 100644 index 000000000000..34f9184e8cde --- /dev/null +++ b/agent/bindings/csharp/Position.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class Position + { + [JsonProperty(PropertyName = "line")] + public int Line { get; set; } + [JsonProperty(PropertyName = "character")] + public int Character { get; set; } + } +} diff --git a/agent/bindings/csharp/ProgressCancelParams.cs b/agent/bindings/csharp/ProgressCancelParams.cs new file mode 100644 index 000000000000..0d55838dfd49 --- /dev/null +++ b/agent/bindings/csharp/ProgressCancelParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ProgressCancelParams + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + } +} diff --git a/agent/bindings/csharp/ProgressEndParams.cs b/agent/bindings/csharp/ProgressEndParams.cs new file mode 100644 index 000000000000..136b6e30d3c2 --- /dev/null +++ b/agent/bindings/csharp/ProgressEndParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ProgressEndParams + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + } +} diff --git a/agent/bindings/csharp/ProgressOptions.cs b/agent/bindings/csharp/ProgressOptions.cs new file mode 100644 index 000000000000..b139b9f4db68 --- /dev/null +++ b/agent/bindings/csharp/ProgressOptions.cs @@ -0,0 +1,16 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ProgressOptions + { + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + [JsonProperty(PropertyName = "locationViewId")] + public string LocationViewId { get; set; } + [JsonProperty(PropertyName = "cancellable")] + public bool Cancellable { get; set; } + } +} diff --git a/agent/bindings/csharp/ProgressReportParams.cs b/agent/bindings/csharp/ProgressReportParams.cs new file mode 100644 index 000000000000..418482558fa4 --- /dev/null +++ b/agent/bindings/csharp/ProgressReportParams.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ProgressReportParams + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + [JsonProperty(PropertyName = "increment")] + public int Increment { get; set; } + } +} diff --git a/agent/bindings/csharp/ProgressStartParams.cs b/agent/bindings/csharp/ProgressStartParams.cs new file mode 100644 index 000000000000..a8a58b4bd6cd --- /dev/null +++ b/agent/bindings/csharp/ProgressStartParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ProgressStartParams + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + [JsonProperty(PropertyName = "options")] + public ProgressOptions Options { get; set; } + } +} diff --git a/agent/bindings/csharp/ProtocolCodeAction.cs b/agent/bindings/csharp/ProtocolCodeAction.cs new file mode 100644 index 000000000000..43623081ac8b --- /dev/null +++ b/agent/bindings/csharp/ProtocolCodeAction.cs @@ -0,0 +1,22 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ProtocolCodeAction + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + [JsonProperty(PropertyName = "commandID")] + public string CommandID { get; set; } + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + [JsonProperty(PropertyName = "diagnostics")] + public ProtocolDiagnostic[] Diagnostics { get; set; } + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + [JsonProperty(PropertyName = "isPreferred")] + public bool IsPreferred { get; set; } + [JsonProperty(PropertyName = "disabled")] + public DisabledParams Disabled { get; set; } + } +} diff --git a/agent/bindings/csharp/ProtocolCodeLens.cs b/agent/bindings/csharp/ProtocolCodeLens.cs new file mode 100644 index 000000000000..225391ab4157 --- /dev/null +++ b/agent/bindings/csharp/ProtocolCodeLens.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ProtocolCodeLens + { + [JsonProperty(PropertyName = "range")] + public Range Range { get; set; } + [JsonProperty(PropertyName = "command")] + public ProtocolCommand Command { get; set; } + [JsonProperty(PropertyName = "isResolved")] + public bool IsResolved { get; set; } + } +} diff --git a/agent/bindings/csharp/ProtocolCommand.cs b/agent/bindings/csharp/ProtocolCommand.cs new file mode 100644 index 000000000000..b8ad1506f854 --- /dev/null +++ b/agent/bindings/csharp/ProtocolCommand.cs @@ -0,0 +1,16 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ProtocolCommand + { + [JsonProperty(PropertyName = "title")] + public TitleParams Title { get; set; } + [JsonProperty(PropertyName = "command")] + public string Command { get; set; } + [JsonProperty(PropertyName = "tooltip")] + public string Tooltip { get; set; } + [JsonProperty(PropertyName = "arguments")] + public Object[] Arguments { get; set; } + } +} diff --git a/agent/bindings/csharp/ProtocolDiagnostic.cs b/agent/bindings/csharp/ProtocolDiagnostic.cs new file mode 100644 index 000000000000..74f377633bdd --- /dev/null +++ b/agent/bindings/csharp/ProtocolDiagnostic.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ProtocolDiagnostic + { + [JsonProperty(PropertyName = "location")] + public ProtocolLocation Location { get; set; } + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + [JsonProperty(PropertyName = "severity")] + public DiagnosticSeverity Severity { get; set; } // Oneof: error, warning, info, suggestion + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + [JsonProperty(PropertyName = "source")] + public string Source { get; set; } + [JsonProperty(PropertyName = "relatedInformation")] + public ProtocolRelatedInformationDiagnostic[] RelatedInformation { get; set; } + } +} diff --git a/agent/bindings/csharp/ProtocolLocation.cs b/agent/bindings/csharp/ProtocolLocation.cs new file mode 100644 index 000000000000..3312ddb23a5c --- /dev/null +++ b/agent/bindings/csharp/ProtocolLocation.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ProtocolLocation + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "range")] + public Range Range { get; set; } + } +} diff --git a/agent/bindings/csharp/ProtocolRelatedInformationDiagnostic.cs b/agent/bindings/csharp/ProtocolRelatedInformationDiagnostic.cs new file mode 100644 index 000000000000..f23aee9e0fe5 --- /dev/null +++ b/agent/bindings/csharp/ProtocolRelatedInformationDiagnostic.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ProtocolRelatedInformationDiagnostic + { + [JsonProperty(PropertyName = "location")] + public ProtocolLocation Location { get; set; } + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + } +} diff --git a/agent/bindings/csharp/ProtocolTextDocument.cs b/agent/bindings/csharp/ProtocolTextDocument.cs new file mode 100644 index 000000000000..b73265361b5c --- /dev/null +++ b/agent/bindings/csharp/ProtocolTextDocument.cs @@ -0,0 +1,22 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ProtocolTextDocument + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "filePath")] + public string FilePath { get; set; } + [JsonProperty(PropertyName = "content")] + public string Content { get; set; } + [JsonProperty(PropertyName = "selection")] + public Range Selection { get; set; } + [JsonProperty(PropertyName = "contentChanges")] + public ProtocolTextDocumentContentChangeEvent[] ContentChanges { get; set; } + [JsonProperty(PropertyName = "visibleRange")] + public Range VisibleRange { get; set; } + [JsonProperty(PropertyName = "testing")] + public TestingParams Testing { get; set; } + } +} diff --git a/agent/bindings/csharp/ProtocolTextDocumentContentChangeEvent.cs b/agent/bindings/csharp/ProtocolTextDocumentContentChangeEvent.cs new file mode 100644 index 000000000000..8a56a25f425a --- /dev/null +++ b/agent/bindings/csharp/ProtocolTextDocumentContentChangeEvent.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ProtocolTextDocumentContentChangeEvent + { + [JsonProperty(PropertyName = "range")] + public Range Range { get; set; } + [JsonProperty(PropertyName = "text")] + public string Text { get; set; } + } +} diff --git a/agent/bindings/csharp/ProtocolTypeAdapters.cs b/agent/bindings/csharp/ProtocolTypeAdapters.cs new file mode 100644 index 000000000000..eb4ad72b7aa9 --- /dev/null +++ b/agent/bindings/csharp/ProtocolTypeAdapters.cs @@ -0,0 +1,12 @@ +namespace Cody.Core.Agent.Protocol; +{ + public static class ProtocolTypeAdapters + { + public static void Register(JsonSerializerOptions options) + { + options.Converters.Add(new ContextItemConverter()); + options.Converters.Add(new CustomCommandResultConverter()); + options.Converters.Add(new TextEditConverter()); + options.Converters.Add(new WorkspaceEditOperationConverter()); + } +} diff --git a/agent/bindings/csharp/ProviderId.cs b/agent/bindings/csharp/ProviderId.cs new file mode 100644 index 000000000000..4499d5f3d405 --- /dev/null +++ b/agent/bindings/csharp/ProviderId.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ProviderId + { + public string Value { get; set; } + + public static implicit operator string(ProviderId value) => value.Value; + public static implicit operator ProviderId(string value) => new ProviderId { Value = value }; + } +} diff --git a/agent/bindings/csharp/Range.cs b/agent/bindings/csharp/Range.cs new file mode 100644 index 000000000000..50a4e098a5c1 --- /dev/null +++ b/agent/bindings/csharp/Range.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class Range + { + [JsonProperty(PropertyName = "start")] + public Position Start { get; set; } + [JsonProperty(PropertyName = "end")] + public Position End { get; set; } + } +} diff --git a/agent/bindings/csharp/RangeData.cs b/agent/bindings/csharp/RangeData.cs new file mode 100644 index 000000000000..16c18685787d --- /dev/null +++ b/agent/bindings/csharp/RangeData.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class RangeData + { + [JsonProperty(PropertyName = "start")] + public StartParams Start { get; set; } + [JsonProperty(PropertyName = "end")] + public EndParams End { get; set; } + } +} diff --git a/agent/bindings/csharp/RemoteRepoFetchState.cs b/agent/bindings/csharp/RemoteRepoFetchState.cs new file mode 100644 index 000000000000..574f049a6dc7 --- /dev/null +++ b/agent/bindings/csharp/RemoteRepoFetchState.cs @@ -0,0 +1,24 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class RemoteRepoFetchState + { + [JsonProperty(PropertyName = "state")] + public StateEnum State { get; set; } // Oneof: paused, fetching, errored, complete + [JsonProperty(PropertyName = "error")] + public CodyError Error { get; set; } + + public enum StateEnum + { + [EnumMember(Value = "paused")] + Paused, + [EnumMember(Value = "fetching")] + Fetching, + [EnumMember(Value = "errored")] + Errored, + [EnumMember(Value = "complete")] + Complete, + } + } +} diff --git a/agent/bindings/csharp/RemoteRepoHasParams.cs b/agent/bindings/csharp/RemoteRepoHasParams.cs new file mode 100644 index 000000000000..8ee16f1f2668 --- /dev/null +++ b/agent/bindings/csharp/RemoteRepoHasParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class RemoteRepoHasParams + { + [JsonProperty(PropertyName = "repoName")] + public string RepoName { get; set; } + } +} diff --git a/agent/bindings/csharp/RemoteRepoHasResult.cs b/agent/bindings/csharp/RemoteRepoHasResult.cs new file mode 100644 index 000000000000..f56a0b1f83cb --- /dev/null +++ b/agent/bindings/csharp/RemoteRepoHasResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class RemoteRepoHasResult + { + [JsonProperty(PropertyName = "result")] + public bool Result { get; set; } + } +} diff --git a/agent/bindings/csharp/RemoteRepoListParams.cs b/agent/bindings/csharp/RemoteRepoListParams.cs new file mode 100644 index 000000000000..6b38ccefa20a --- /dev/null +++ b/agent/bindings/csharp/RemoteRepoListParams.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class RemoteRepoListParams + { + [JsonProperty(PropertyName = "query")] + public string Query { get; set; } + [JsonProperty(PropertyName = "first")] + public int First { get; set; } + [JsonProperty(PropertyName = "afterId")] + public string AfterId { get; set; } + } +} diff --git a/agent/bindings/csharp/RemoteRepoListResult.cs b/agent/bindings/csharp/RemoteRepoListResult.cs new file mode 100644 index 000000000000..712d85610432 --- /dev/null +++ b/agent/bindings/csharp/RemoteRepoListResult.cs @@ -0,0 +1,16 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class RemoteRepoListResult + { + [JsonProperty(PropertyName = "startIndex")] + public int StartIndex { get; set; } + [JsonProperty(PropertyName = "count")] + public int Count { get; set; } + [JsonProperty(PropertyName = "repos")] + public ReposParams[] Repos { get; set; } + [JsonProperty(PropertyName = "state")] + public RemoteRepoFetchState State { get; set; } + } +} diff --git a/agent/bindings/csharp/RenameFile.cs b/agent/bindings/csharp/RenameFile.cs new file mode 100644 index 000000000000..81c9ad9e9304 --- /dev/null +++ b/agent/bindings/csharp/RenameFile.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class RenameFile + { + [JsonProperty(PropertyName = "oldUri")] + public string OldUri { get; set; } + [JsonProperty(PropertyName = "newUri")] + public string NewUri { get; set; } + } +} diff --git a/agent/bindings/csharp/RenameFilesParams.cs b/agent/bindings/csharp/RenameFilesParams.cs new file mode 100644 index 000000000000..2ede65fdbe88 --- /dev/null +++ b/agent/bindings/csharp/RenameFilesParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class RenameFilesParams + { + [JsonProperty(PropertyName = "files")] + public RenameFile[] Files { get; set; } + } +} diff --git a/agent/bindings/csharp/Repo.cs b/agent/bindings/csharp/Repo.cs new file mode 100644 index 000000000000..33fb105a2d79 --- /dev/null +++ b/agent/bindings/csharp/Repo.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class Repo + { + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + } +} diff --git a/agent/bindings/csharp/ReposParams.cs b/agent/bindings/csharp/ReposParams.cs new file mode 100644 index 000000000000..e7c36610fba8 --- /dev/null +++ b/agent/bindings/csharp/ReposParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ReposParams + { + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + } +} diff --git a/agent/bindings/csharp/SaveDialogOptionsParams.cs b/agent/bindings/csharp/SaveDialogOptionsParams.cs new file mode 100644 index 000000000000..dabce13b6b5e --- /dev/null +++ b/agent/bindings/csharp/SaveDialogOptionsParams.cs @@ -0,0 +1,16 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class SaveDialogOptionsParams + { + [JsonProperty(PropertyName = "defaultUri")] + public string DefaultUri { get; set; } + [JsonProperty(PropertyName = "saveLabel")] + public string SaveLabel { get; set; } + [JsonProperty(PropertyName = "filters")] + public Dictionary Filters { get; set; } + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + } +} diff --git a/agent/bindings/csharp/SelectedCompletionInfo.cs b/agent/bindings/csharp/SelectedCompletionInfo.cs new file mode 100644 index 000000000000..beb8fe487b16 --- /dev/null +++ b/agent/bindings/csharp/SelectedCompletionInfo.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class SelectedCompletionInfo + { + [JsonProperty(PropertyName = "range")] + public Range Range { get; set; } + [JsonProperty(PropertyName = "text")] + public string Text { get; set; } + } +} diff --git a/agent/bindings/csharp/SelectedReposParams.cs b/agent/bindings/csharp/SelectedReposParams.cs new file mode 100644 index 000000000000..8724e3b65c1c --- /dev/null +++ b/agent/bindings/csharp/SelectedReposParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class SelectedReposParams + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + } +} diff --git a/agent/bindings/csharp/SerializedChatInteraction.cs b/agent/bindings/csharp/SerializedChatInteraction.cs new file mode 100644 index 000000000000..4a81e367af89 --- /dev/null +++ b/agent/bindings/csharp/SerializedChatInteraction.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class SerializedChatInteraction + { + [JsonProperty(PropertyName = "humanMessage")] + public SerializedChatMessage HumanMessage { get; set; } + [JsonProperty(PropertyName = "assistantMessage")] + public SerializedChatMessage AssistantMessage { get; set; } + } +} diff --git a/agent/bindings/csharp/SerializedChatMessage.cs b/agent/bindings/csharp/SerializedChatMessage.cs new file mode 100644 index 000000000000..2cf7cbe32761 --- /dev/null +++ b/agent/bindings/csharp/SerializedChatMessage.cs @@ -0,0 +1,30 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class SerializedChatMessage + { + [JsonProperty(PropertyName = "contextFiles")] + public ContextItem[] ContextFiles { get; set; } + [JsonProperty(PropertyName = "error")] + public ChatError Error { get; set; } + [JsonProperty(PropertyName = "editorState")] + public Object EditorState { get; set; } + [JsonProperty(PropertyName = "speaker")] + public SpeakerEnum Speaker { get; set; } // Oneof: human, assistant, system + [JsonProperty(PropertyName = "text")] + public string Text { get; set; } + [JsonProperty(PropertyName = "model")] + public string Model { get; set; } + + public enum SpeakerEnum + { + [EnumMember(Value = "human")] + Human, + [EnumMember(Value = "assistant")] + Assistant, + [EnumMember(Value = "system")] + System, + } + } +} diff --git a/agent/bindings/csharp/SerializedChatTranscript.cs b/agent/bindings/csharp/SerializedChatTranscript.cs new file mode 100644 index 000000000000..4fe454289bd3 --- /dev/null +++ b/agent/bindings/csharp/SerializedChatTranscript.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class SerializedChatTranscript + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + [JsonProperty(PropertyName = "chatTitle")] + public string ChatTitle { get; set; } + [JsonProperty(PropertyName = "interactions")] + public SerializedChatInteraction[] Interactions { get; set; } + [JsonProperty(PropertyName = "lastInteractionTimestamp")] + public string LastInteractionTimestamp { get; set; } + [JsonProperty(PropertyName = "enhancedContext")] + public EnhancedContextParams EnhancedContext { get; set; } + } +} diff --git a/agent/bindings/csharp/ServerInfo.cs b/agent/bindings/csharp/ServerInfo.cs new file mode 100644 index 000000000000..f77f817660d8 --- /dev/null +++ b/agent/bindings/csharp/ServerInfo.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ServerInfo + { + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + [JsonProperty(PropertyName = "authenticated")] + public bool Authenticated { get; set; } + [JsonProperty(PropertyName = "codyEnabled")] + public bool CodyEnabled { get; set; } + [JsonProperty(PropertyName = "codyVersion")] + public string CodyVersion { get; set; } + [JsonProperty(PropertyName = "authStatus")] + public AuthStatus AuthStatus { get; set; } + } +} diff --git a/agent/bindings/csharp/ShowOptionsParams.cs b/agent/bindings/csharp/ShowOptionsParams.cs new file mode 100644 index 000000000000..352b760be510 --- /dev/null +++ b/agent/bindings/csharp/ShowOptionsParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ShowOptionsParams + { + [JsonProperty(PropertyName = "preserveFocus")] + public bool PreserveFocus { get; set; } + [JsonProperty(PropertyName = "viewColumn")] + public int ViewColumn { get; set; } + } +} diff --git a/agent/bindings/csharp/ShowWindowMessageParams.cs b/agent/bindings/csharp/ShowWindowMessageParams.cs new file mode 100644 index 000000000000..a7ed89610c81 --- /dev/null +++ b/agent/bindings/csharp/ShowWindowMessageParams.cs @@ -0,0 +1,26 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class ShowWindowMessageParams + { + [JsonProperty(PropertyName = "severity")] + public SeverityEnum Severity { get; set; } // Oneof: error, warning, information + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + [JsonProperty(PropertyName = "options")] + public MessageOptions Options { get; set; } + [JsonProperty(PropertyName = "items")] + public string[] Items { get; set; } + + public enum SeverityEnum + { + [EnumMember(Value = "error")] + Error, + [EnumMember(Value = "warning")] + Warning, + [EnumMember(Value = "information")] + Information, + } + } +} diff --git a/agent/bindings/csharp/SourceParams.cs b/agent/bindings/csharp/SourceParams.cs new file mode 100644 index 000000000000..190b23b65424 --- /dev/null +++ b/agent/bindings/csharp/SourceParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class SourceParams + { + [JsonProperty(PropertyName = "client")] + public string Client { get; set; } + [JsonProperty(PropertyName = "clientVersion")] + public string ClientVersion { get; set; } + } +} diff --git a/agent/bindings/csharp/StartParams.cs b/agent/bindings/csharp/StartParams.cs new file mode 100644 index 000000000000..ff44bde78491 --- /dev/null +++ b/agent/bindings/csharp/StartParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class StartParams + { + [JsonProperty(PropertyName = "line")] + public int Line { get; set; } + [JsonProperty(PropertyName = "character")] + public int Character { get; set; } + } +} diff --git a/agent/bindings/csharp/SymbolKind.cs b/agent/bindings/csharp/SymbolKind.cs new file mode 100644 index 000000000000..6961d697b1b9 --- /dev/null +++ b/agent/bindings/csharp/SymbolKind.cs @@ -0,0 +1,15 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + + public enum SymbolKind + { + [EnumMember(Value = "class")] + Class, + [EnumMember(Value = "function")] + Function, + [EnumMember(Value = "method")] + Method, + } +} diff --git a/agent/bindings/csharp/TelemetryEvent.cs b/agent/bindings/csharp/TelemetryEvent.cs new file mode 100644 index 000000000000..9ae25a040079 --- /dev/null +++ b/agent/bindings/csharp/TelemetryEvent.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TelemetryEvent + { + [JsonProperty(PropertyName = "feature")] + public string Feature { get; set; } + [JsonProperty(PropertyName = "action")] + public string Action { get; set; } + } +} diff --git a/agent/bindings/csharp/TestingClosestPostDataParams.cs b/agent/bindings/csharp/TestingClosestPostDataParams.cs new file mode 100644 index 000000000000..49d64e92319a --- /dev/null +++ b/agent/bindings/csharp/TestingClosestPostDataParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TestingClosestPostDataParams + { + [JsonProperty(PropertyName = "url")] + public string Url { get; set; } + [JsonProperty(PropertyName = "postData")] + public string PostData { get; set; } + } +} diff --git a/agent/bindings/csharp/TestingClosestPostDataResult.cs b/agent/bindings/csharp/TestingClosestPostDataResult.cs new file mode 100644 index 000000000000..c73daf61053d --- /dev/null +++ b/agent/bindings/csharp/TestingClosestPostDataResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TestingClosestPostDataResult + { + [JsonProperty(PropertyName = "closestBody")] + public string ClosestBody { get; set; } + } +} diff --git a/agent/bindings/csharp/TestingDiagnosticsParams.cs b/agent/bindings/csharp/TestingDiagnosticsParams.cs new file mode 100644 index 000000000000..6a974da21a14 --- /dev/null +++ b/agent/bindings/csharp/TestingDiagnosticsParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TestingDiagnosticsParams + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + } +} diff --git a/agent/bindings/csharp/TestingDiagnosticsResult.cs b/agent/bindings/csharp/TestingDiagnosticsResult.cs new file mode 100644 index 000000000000..25e1554afb12 --- /dev/null +++ b/agent/bindings/csharp/TestingDiagnosticsResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TestingDiagnosticsResult + { + [JsonProperty(PropertyName = "diagnostics")] + public ProtocolDiagnostic[] Diagnostics { get; set; } + } +} diff --git a/agent/bindings/csharp/TestingExportedTelemetryEventsResult.cs b/agent/bindings/csharp/TestingExportedTelemetryEventsResult.cs new file mode 100644 index 000000000000..330fc9bc425f --- /dev/null +++ b/agent/bindings/csharp/TestingExportedTelemetryEventsResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TestingExportedTelemetryEventsResult + { + [JsonProperty(PropertyName = "events")] + public TestingTelemetryEvent[] Events { get; set; } + } +} diff --git a/agent/bindings/csharp/TestingMemoryUsageResult.cs b/agent/bindings/csharp/TestingMemoryUsageResult.cs new file mode 100644 index 000000000000..8b36cfde2e7a --- /dev/null +++ b/agent/bindings/csharp/TestingMemoryUsageResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TestingMemoryUsageResult + { + [JsonProperty(PropertyName = "usage")] + public MemoryUsage Usage { get; set; } + } +} diff --git a/agent/bindings/csharp/TestingNetworkRequestsResult.cs b/agent/bindings/csharp/TestingNetworkRequestsResult.cs new file mode 100644 index 000000000000..91795c4a50cf --- /dev/null +++ b/agent/bindings/csharp/TestingNetworkRequestsResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TestingNetworkRequestsResult + { + [JsonProperty(PropertyName = "requests")] + public NetworkRequest[] Requests { get; set; } + } +} diff --git a/agent/bindings/csharp/TestingParams.cs b/agent/bindings/csharp/TestingParams.cs new file mode 100644 index 000000000000..5f80b808f842 --- /dev/null +++ b/agent/bindings/csharp/TestingParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TestingParams + { + [JsonProperty(PropertyName = "selectedText")] + public string SelectedText { get; set; } + [JsonProperty(PropertyName = "sourceOfTruthDocument")] + public ProtocolTextDocument SourceOfTruthDocument { get; set; } + } +} diff --git a/agent/bindings/csharp/TestingProgressCancelationParams.cs b/agent/bindings/csharp/TestingProgressCancelationParams.cs new file mode 100644 index 000000000000..94831052cd6d --- /dev/null +++ b/agent/bindings/csharp/TestingProgressCancelationParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TestingProgressCancelationParams + { + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + } +} diff --git a/agent/bindings/csharp/TestingProgressCancelationResult.cs b/agent/bindings/csharp/TestingProgressCancelationResult.cs new file mode 100644 index 000000000000..47f11cacdd1f --- /dev/null +++ b/agent/bindings/csharp/TestingProgressCancelationResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TestingProgressCancelationResult + { + [JsonProperty(PropertyName = "result")] + public string Result { get; set; } + } +} diff --git a/agent/bindings/csharp/TestingProgressParams.cs b/agent/bindings/csharp/TestingProgressParams.cs new file mode 100644 index 000000000000..d0eea27ee315 --- /dev/null +++ b/agent/bindings/csharp/TestingProgressParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TestingProgressParams + { + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + } +} diff --git a/agent/bindings/csharp/TestingProgressResult.cs b/agent/bindings/csharp/TestingProgressResult.cs new file mode 100644 index 000000000000..c8d0bba3ef71 --- /dev/null +++ b/agent/bindings/csharp/TestingProgressResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TestingProgressResult + { + [JsonProperty(PropertyName = "result")] + public string Result { get; set; } + } +} diff --git a/agent/bindings/csharp/TestingRequestErrorsResult.cs b/agent/bindings/csharp/TestingRequestErrorsResult.cs new file mode 100644 index 000000000000..43f0150a87ed --- /dev/null +++ b/agent/bindings/csharp/TestingRequestErrorsResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TestingRequestErrorsResult + { + [JsonProperty(PropertyName = "errors")] + public NetworkRequest[] Errors { get; set; } + } +} diff --git a/agent/bindings/csharp/TestingTelemetryEvent.cs b/agent/bindings/csharp/TestingTelemetryEvent.cs new file mode 100644 index 000000000000..ef419472297a --- /dev/null +++ b/agent/bindings/csharp/TestingTelemetryEvent.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TestingTelemetryEvent + { + [JsonProperty(PropertyName = "feature")] + public string Feature { get; set; } + [JsonProperty(PropertyName = "action")] + public string Action { get; set; } + [JsonProperty(PropertyName = "source")] + public SourceParams Source { get; set; } + [JsonProperty(PropertyName = "timestamp")] + public string Timestamp { get; set; } + [JsonProperty(PropertyName = "testOnlyAnonymousUserID")] + public string TestOnlyAnonymousUserID { get; set; } + } +} diff --git a/agent/bindings/csharp/TextDocumentChangeResult.cs b/agent/bindings/csharp/TextDocumentChangeResult.cs new file mode 100644 index 000000000000..231eb694bd49 --- /dev/null +++ b/agent/bindings/csharp/TextDocumentChangeResult.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TextDocumentChangeResult + { + [JsonProperty(PropertyName = "success")] + public bool Success { get; set; } + } +} diff --git a/agent/bindings/csharp/TextDocumentDidFocusParams.cs b/agent/bindings/csharp/TextDocumentDidFocusParams.cs new file mode 100644 index 000000000000..3e2ccf1be0c8 --- /dev/null +++ b/agent/bindings/csharp/TextDocumentDidFocusParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TextDocumentDidFocusParams + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + } +} diff --git a/agent/bindings/csharp/TextDocumentDidSaveParams.cs b/agent/bindings/csharp/TextDocumentDidSaveParams.cs new file mode 100644 index 000000000000..9a83b267c242 --- /dev/null +++ b/agent/bindings/csharp/TextDocumentDidSaveParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TextDocumentDidSaveParams + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + } +} diff --git a/agent/bindings/csharp/TextDocumentEditParams.cs b/agent/bindings/csharp/TextDocumentEditParams.cs new file mode 100644 index 000000000000..e093a4a773a7 --- /dev/null +++ b/agent/bindings/csharp/TextDocumentEditParams.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TextDocumentEditParams + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "edits")] + public TextEdit[] Edits { get; set; } + [JsonProperty(PropertyName = "options")] + public OptionsParams Options { get; set; } + } +} diff --git a/agent/bindings/csharp/TextDocumentShowOptionsParams.cs b/agent/bindings/csharp/TextDocumentShowOptionsParams.cs new file mode 100644 index 000000000000..23bd98b8c6c7 --- /dev/null +++ b/agent/bindings/csharp/TextDocumentShowOptionsParams.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TextDocumentShowOptionsParams + { + [JsonProperty(PropertyName = "preserveFocus")] + public bool PreserveFocus { get; set; } + [JsonProperty(PropertyName = "preview")] + public bool Preview { get; set; } + [JsonProperty(PropertyName = "selection")] + public Range Selection { get; set; } + } +} diff --git a/agent/bindings/csharp/TextDocumentShowParams.cs b/agent/bindings/csharp/TextDocumentShowParams.cs new file mode 100644 index 000000000000..6e943b686a55 --- /dev/null +++ b/agent/bindings/csharp/TextDocumentShowParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TextDocumentShowParams + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "options")] + public TextDocumentShowOptionsParams Options { get; set; } + } +} diff --git a/agent/bindings/csharp/TextEdit.cs b/agent/bindings/csharp/TextEdit.cs new file mode 100644 index 000000000000..f4f915c6b0da --- /dev/null +++ b/agent/bindings/csharp/TextEdit.cs @@ -0,0 +1,85 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + + [JsonConverter(typeof(TextEditConverter))] + public abstract class TextEdit + { + private class TextEditConverter : JsonConverter + { + public override TextEdit Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var jsonDoc = JsonDocument.ParseValue(ref reader); + var discriminator = jsonDoc.RootElement.GetProperty("type").GetString(); + switch (discriminator) + { + case "replace": + return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); + case "insert": + return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); + case "delete": + return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); + default: + throw new JsonException($"Unknown discriminator {discriminator}"); + } + } + public override void Write(Utf8JsonWriter writer, ${name} value, JsonSerializerOptions options) + { + JsonSerializer.Serialize(writer, value, value.GetType(), options); + } + } + + public class ReplaceTextEdit : TextEdit + { + [JsonProperty(PropertyName = "type")] + public TypeEnum Type { get; set; } // Oneof: replace + [JsonProperty(PropertyName = "range")] + public Range Range { get; set; } + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + [JsonProperty(PropertyName = "metadata")] + public WorkspaceEditEntryMetadata Metadata { get; set; } + + public enum TypeEnum + { + [EnumMember(Value = "replace")] + Replace, + } + } + + public class InsertTextEdit : TextEdit + { + [JsonProperty(PropertyName = "type")] + public TypeEnum Type { get; set; } // Oneof: insert + [JsonProperty(PropertyName = "position")] + public Position Position { get; set; } + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + [JsonProperty(PropertyName = "metadata")] + public WorkspaceEditEntryMetadata Metadata { get; set; } + + public enum TypeEnum + { + [EnumMember(Value = "insert")] + Insert, + } + } + + public class DeleteTextEdit : TextEdit + { + [JsonProperty(PropertyName = "type")] + public TypeEnum Type { get; set; } // Oneof: delete + [JsonProperty(PropertyName = "range")] + public Range Range { get; set; } + [JsonProperty(PropertyName = "metadata")] + public WorkspaceEditEntryMetadata Metadata { get; set; } + + public enum TypeEnum + { + [EnumMember(Value = "delete")] + Delete, + } + } + } +} diff --git a/agent/bindings/csharp/TitleParams.cs b/agent/bindings/csharp/TitleParams.cs new file mode 100644 index 000000000000..7ebee9c49d58 --- /dev/null +++ b/agent/bindings/csharp/TitleParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class TitleParams + { + [JsonProperty(PropertyName = "text")] + public string Text { get; set; } + [JsonProperty(PropertyName = "icons")] + public IconsParams[] Icons { get; set; } + } +} diff --git a/agent/bindings/csharp/UntitledTextDocument.cs b/agent/bindings/csharp/UntitledTextDocument.cs new file mode 100644 index 000000000000..58c41e4cfba4 --- /dev/null +++ b/agent/bindings/csharp/UntitledTextDocument.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class UntitledTextDocument + { + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "content")] + public string Content { get; set; } + [JsonProperty(PropertyName = "language")] + public string Language { get; set; } + } +} diff --git a/agent/bindings/csharp/Uri.cs b/agent/bindings/csharp/Uri.cs new file mode 100644 index 000000000000..571d6a215f89 --- /dev/null +++ b/agent/bindings/csharp/Uri.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class Uri + { + [JsonProperty(PropertyName = "scheme")] + public string Scheme { get; set; } + [JsonProperty(PropertyName = "authority")] + public string Authority { get; set; } + [JsonProperty(PropertyName = "path")] + public string Path { get; set; } + [JsonProperty(PropertyName = "query")] + public string Query { get; set; } + [JsonProperty(PropertyName = "fragment")] + public string Fragment { get; set; } + [JsonProperty(PropertyName = "fsPath")] + public string FsPath { get; set; } + } +} diff --git a/agent/bindings/csharp/WebviewCreateWebviewPanelOptions.cs b/agent/bindings/csharp/WebviewCreateWebviewPanelOptions.cs new file mode 100644 index 000000000000..10a8ecf1ba07 --- /dev/null +++ b/agent/bindings/csharp/WebviewCreateWebviewPanelOptions.cs @@ -0,0 +1,22 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WebviewCreateWebviewPanelOptions + { + [JsonProperty(PropertyName = "enableScripts")] + public bool EnableScripts { get; set; } + [JsonProperty(PropertyName = "enableForms")] + public bool EnableForms { get; set; } + [JsonProperty(PropertyName = "enableOnlyCommandUris")] + public string[] EnableOnlyCommandUris { get; set; } + [JsonProperty(PropertyName = "localResourceRoots")] + public string[] LocalResourceRoots { get; set; } + [JsonProperty(PropertyName = "portMapping")] + public PortMappingParams[] PortMapping { get; set; } + [JsonProperty(PropertyName = "enableFindWidget")] + public bool EnableFindWidget { get; set; } + [JsonProperty(PropertyName = "retainContextWhenHidden")] + public bool RetainContextWhenHidden { get; set; } + } +} diff --git a/agent/bindings/csharp/WebviewCreateWebviewPanelParams.cs b/agent/bindings/csharp/WebviewCreateWebviewPanelParams.cs new file mode 100644 index 000000000000..83051fb4748d --- /dev/null +++ b/agent/bindings/csharp/WebviewCreateWebviewPanelParams.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WebviewCreateWebviewPanelParams + { + [JsonProperty(PropertyName = "handle")] + public string Handle { get; set; } + [JsonProperty(PropertyName = "viewType")] + public string ViewType { get; set; } + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + [JsonProperty(PropertyName = "showOptions")] + public ShowOptionsParams ShowOptions { get; set; } + [JsonProperty(PropertyName = "options")] + public WebviewCreateWebviewPanelOptions Options { get; set; } + } +} diff --git a/agent/bindings/csharp/WebviewDidDisposeNativeParams.cs b/agent/bindings/csharp/WebviewDidDisposeNativeParams.cs new file mode 100644 index 000000000000..38f0dd791644 --- /dev/null +++ b/agent/bindings/csharp/WebviewDidDisposeNativeParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WebviewDidDisposeNativeParams + { + [JsonProperty(PropertyName = "handle")] + public string Handle { get; set; } + } +} diff --git a/agent/bindings/csharp/WebviewDidDisposeParams.cs b/agent/bindings/csharp/WebviewDidDisposeParams.cs new file mode 100644 index 000000000000..d3ba99421162 --- /dev/null +++ b/agent/bindings/csharp/WebviewDidDisposeParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WebviewDidDisposeParams + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + } +} diff --git a/agent/bindings/csharp/WebviewDisposeParams.cs b/agent/bindings/csharp/WebviewDisposeParams.cs new file mode 100644 index 000000000000..0c9ba41e876b --- /dev/null +++ b/agent/bindings/csharp/WebviewDisposeParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WebviewDisposeParams + { + [JsonProperty(PropertyName = "handle")] + public string Handle { get; set; } + } +} diff --git a/agent/bindings/csharp/WebviewNativeConfigParams.cs b/agent/bindings/csharp/WebviewNativeConfigParams.cs new file mode 100644 index 000000000000..de76503e089d --- /dev/null +++ b/agent/bindings/csharp/WebviewNativeConfigParams.cs @@ -0,0 +1,28 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WebviewNativeConfigParams + { + [JsonProperty(PropertyName = "view")] + public ViewEnum View { get; set; } // Oneof: multiple, single + [JsonProperty(PropertyName = "cspSource")] + public string CspSource { get; set; } + [JsonProperty(PropertyName = "webviewBundleServingPrefix")] + public string WebviewBundleServingPrefix { get; set; } + [JsonProperty(PropertyName = "rootDir")] + public string RootDir { get; set; } + [JsonProperty(PropertyName = "injectScript")] + public string InjectScript { get; set; } + [JsonProperty(PropertyName = "injectStyle")] + public string InjectStyle { get; set; } + + public enum ViewEnum + { + [EnumMember(Value = "multiple")] + Multiple, + [EnumMember(Value = "single")] + Single, + } + } +} diff --git a/agent/bindings/csharp/WebviewPostMessageStringEncodedParams.cs b/agent/bindings/csharp/WebviewPostMessageStringEncodedParams.cs new file mode 100644 index 000000000000..b4a874779f93 --- /dev/null +++ b/agent/bindings/csharp/WebviewPostMessageStringEncodedParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WebviewPostMessageStringEncodedParams + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + [JsonProperty(PropertyName = "stringEncodedMessage")] + public string StringEncodedMessage { get; set; } + } +} diff --git a/agent/bindings/csharp/WebviewReceiveMessageStringEncodedParams.cs b/agent/bindings/csharp/WebviewReceiveMessageStringEncodedParams.cs new file mode 100644 index 000000000000..3358e30c9f16 --- /dev/null +++ b/agent/bindings/csharp/WebviewReceiveMessageStringEncodedParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WebviewReceiveMessageStringEncodedParams + { + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + [JsonProperty(PropertyName = "messageStringEncoded")] + public string MessageStringEncoded { get; set; } + } +} diff --git a/agent/bindings/csharp/WebviewRegisterWebviewViewProviderParams.cs b/agent/bindings/csharp/WebviewRegisterWebviewViewProviderParams.cs new file mode 100644 index 000000000000..f9454294b5f7 --- /dev/null +++ b/agent/bindings/csharp/WebviewRegisterWebviewViewProviderParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WebviewRegisterWebviewViewProviderParams + { + [JsonProperty(PropertyName = "viewId")] + public string ViewId { get; set; } + [JsonProperty(PropertyName = "retainContextWhenHidden")] + public bool RetainContextWhenHidden { get; set; } + } +} diff --git a/agent/bindings/csharp/WebviewResolveWebviewViewParams.cs b/agent/bindings/csharp/WebviewResolveWebviewViewParams.cs new file mode 100644 index 000000000000..1c7429f4a381 --- /dev/null +++ b/agent/bindings/csharp/WebviewResolveWebviewViewParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WebviewResolveWebviewViewParams + { + [JsonProperty(PropertyName = "viewId")] + public string ViewId { get; set; } + [JsonProperty(PropertyName = "webviewHandle")] + public string WebviewHandle { get; set; } + } +} diff --git a/agent/bindings/csharp/WebviewRevealParams.cs b/agent/bindings/csharp/WebviewRevealParams.cs new file mode 100644 index 000000000000..aa30a815f8c1 --- /dev/null +++ b/agent/bindings/csharp/WebviewRevealParams.cs @@ -0,0 +1,14 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WebviewRevealParams + { + [JsonProperty(PropertyName = "handle")] + public string Handle { get; set; } + [JsonProperty(PropertyName = "viewColumn")] + public int ViewColumn { get; set; } + [JsonProperty(PropertyName = "preserveFocus")] + public bool PreserveFocus { get; set; } + } +} diff --git a/agent/bindings/csharp/WebviewSetHtmlParams.cs b/agent/bindings/csharp/WebviewSetHtmlParams.cs new file mode 100644 index 000000000000..ca61514c1dfb --- /dev/null +++ b/agent/bindings/csharp/WebviewSetHtmlParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WebviewSetHtmlParams + { + [JsonProperty(PropertyName = "handle")] + public string Handle { get; set; } + [JsonProperty(PropertyName = "html")] + public string Html { get; set; } + } +} diff --git a/agent/bindings/csharp/WebviewSetIconPathParams.cs b/agent/bindings/csharp/WebviewSetIconPathParams.cs new file mode 100644 index 000000000000..797ae7b864ca --- /dev/null +++ b/agent/bindings/csharp/WebviewSetIconPathParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WebviewSetIconPathParams + { + [JsonProperty(PropertyName = "handle")] + public string Handle { get; set; } + [JsonProperty(PropertyName = "iconPathUri")] + public string IconPathUri { get; set; } + } +} diff --git a/agent/bindings/csharp/WebviewSetOptionsParams.cs b/agent/bindings/csharp/WebviewSetOptionsParams.cs new file mode 100644 index 000000000000..f2051d7521df --- /dev/null +++ b/agent/bindings/csharp/WebviewSetOptionsParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WebviewSetOptionsParams + { + [JsonProperty(PropertyName = "handle")] + public string Handle { get; set; } + [JsonProperty(PropertyName = "options")] + public DefiniteWebviewOptions Options { get; set; } + } +} diff --git a/agent/bindings/csharp/WebviewSetTitleParams.cs b/agent/bindings/csharp/WebviewSetTitleParams.cs new file mode 100644 index 000000000000..f49bdff1ac43 --- /dev/null +++ b/agent/bindings/csharp/WebviewSetTitleParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WebviewSetTitleParams + { + [JsonProperty(PropertyName = "handle")] + public string Handle { get; set; } + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + } +} diff --git a/agent/bindings/csharp/WindowDidChangeContextParams.cs b/agent/bindings/csharp/WindowDidChangeContextParams.cs new file mode 100644 index 000000000000..c35a3b6d1fec --- /dev/null +++ b/agent/bindings/csharp/WindowDidChangeContextParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WindowDidChangeContextParams + { + [JsonProperty(PropertyName = "key")] + public string Key { get; set; } + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + } +} diff --git a/agent/bindings/csharp/WorkspaceEditEntryMetadata.cs b/agent/bindings/csharp/WorkspaceEditEntryMetadata.cs new file mode 100644 index 000000000000..061d6ebd036e --- /dev/null +++ b/agent/bindings/csharp/WorkspaceEditEntryMetadata.cs @@ -0,0 +1,16 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WorkspaceEditEntryMetadata + { + [JsonProperty(PropertyName = "needsConfirmation")] + public bool NeedsConfirmation { get; set; } + [JsonProperty(PropertyName = "label")] + public string Label { get; set; } + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + [JsonProperty(PropertyName = "iconPath")] + public Uri IconPath { get; set; } + } +} diff --git a/agent/bindings/csharp/WorkspaceEditMetadata.cs b/agent/bindings/csharp/WorkspaceEditMetadata.cs new file mode 100644 index 000000000000..79053693de76 --- /dev/null +++ b/agent/bindings/csharp/WorkspaceEditMetadata.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WorkspaceEditMetadata + { + [JsonProperty(PropertyName = "isRefactoring")] + public bool IsRefactoring { get; set; } + } +} diff --git a/agent/bindings/csharp/WorkspaceEditOperation.cs b/agent/bindings/csharp/WorkspaceEditOperation.cs new file mode 100644 index 000000000000..265d71d7e525 --- /dev/null +++ b/agent/bindings/csharp/WorkspaceEditOperation.cs @@ -0,0 +1,85 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + + [JsonConverter(typeof(WorkspaceEditOperationConverter))] + public abstract class WorkspaceEditOperation + { + private class WorkspaceEditOperationConverter : JsonConverter + { + public override WorkspaceEditOperation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var jsonDoc = JsonDocument.ParseValue(ref reader); + var discriminator = jsonDoc.RootElement.GetProperty("type").GetString(); + switch (discriminator) + { + case "create-file": + return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); + case "rename-file": + return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); + case "delete-file": + return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); + case "edit-file": + return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); + default: + throw new JsonException($"Unknown discriminator {discriminator}"); + } + } + public override void Write(Utf8JsonWriter writer, ${name} value, JsonSerializerOptions options) + { + JsonSerializer.Serialize(writer, value, value.GetType(), options); + } + } + + public class CreateFileOperation : WorkspaceEditOperation + { + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } // Oneof: create-file + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "options")] + public WriteFileOptions Options { get; set; } + [JsonProperty(PropertyName = "textContents")] + public string TextContents { get; set; } + [JsonProperty(PropertyName = "metadata")] + public WorkspaceEditEntryMetadata Metadata { get; set; } + } + + public class RenameFileOperation : WorkspaceEditOperation + { + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } // Oneof: rename-file + [JsonProperty(PropertyName = "oldUri")] + public string OldUri { get; set; } + [JsonProperty(PropertyName = "newUri")] + public string NewUri { get; set; } + [JsonProperty(PropertyName = "options")] + public WriteFileOptions Options { get; set; } + [JsonProperty(PropertyName = "metadata")] + public WorkspaceEditEntryMetadata Metadata { get; set; } + } + + public class DeleteFileOperation : WorkspaceEditOperation + { + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } // Oneof: delete-file + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "deleteOptions")] + public DeleteOptionsParams DeleteOptions { get; set; } + [JsonProperty(PropertyName = "metadata")] + public WorkspaceEditEntryMetadata Metadata { get; set; } + } + + public class EditFileOperation : WorkspaceEditOperation + { + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } // Oneof: edit-file + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + [JsonProperty(PropertyName = "edits")] + public TextEdit[] Edits { get; set; } + } + } +} diff --git a/agent/bindings/csharp/WorkspaceEditParams.cs b/agent/bindings/csharp/WorkspaceEditParams.cs new file mode 100644 index 000000000000..3c8c98a99e85 --- /dev/null +++ b/agent/bindings/csharp/WorkspaceEditParams.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WorkspaceEditParams + { + [JsonProperty(PropertyName = "operations")] + public WorkspaceEditOperation[] Operations { get; set; } + [JsonProperty(PropertyName = "metadata")] + public WorkspaceEditMetadata Metadata { get; set; } + } +} diff --git a/agent/bindings/csharp/WorkspaceFolderDidChangeParams.cs b/agent/bindings/csharp/WorkspaceFolderDidChangeParams.cs new file mode 100644 index 000000000000..ee697485318f --- /dev/null +++ b/agent/bindings/csharp/WorkspaceFolderDidChangeParams.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WorkspaceFolderDidChangeParams + { + [JsonProperty(PropertyName = "uris")] + public string[] Uris { get; set; } + } +} diff --git a/agent/bindings/csharp/WriteFileOptions.cs b/agent/bindings/csharp/WriteFileOptions.cs new file mode 100644 index 000000000000..310c3026f2eb --- /dev/null +++ b/agent/bindings/csharp/WriteFileOptions.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace Cody.Core.Agent.Protocol +{ + public class WriteFileOptions + { + [JsonProperty(PropertyName = "overwrite")] + public bool Overwrite { get; set; } + [JsonProperty(PropertyName = "ignoreIfExists")] + public bool IgnoreIfExists { get; set; } + } +} From bb61945aa0a57d02f146f1e35a5cbd39a107e853 Mon Sep 17 00:00:00 2001 From: jamesmcnamara Date: Wed, 9 Oct 2024 17:28:24 -0700 Subject: [PATCH 03/10] removed C# bindings after checking that they match --- agent/bindings/csharp/ApiVersionId.cs | 12 - .../csharp/AttributionSearchParams.cs | 12 - .../csharp/AttributionSearchResult.cs | 14 - agent/bindings/csharp/AuthStatus.cs | 46 --- agent/bindings/csharp/AutocompleteItem.cs | 14 - agent/bindings/csharp/AutocompleteParams.cs | 26 -- agent/bindings/csharp/AutocompleteResult.cs | 12 - agent/bindings/csharp/CancelParams.cs | 10 - agent/bindings/csharp/ChatDeleteParams.cs | 10 - agent/bindings/csharp/ChatError.cs | 38 --- agent/bindings/csharp/ChatExportParams.cs | 10 - agent/bindings/csharp/ChatExportResult.cs | 12 - agent/bindings/csharp/ChatModelsParams.cs | 10 - agent/bindings/csharp/ChatModelsResult.cs | 10 - .../bindings/csharp/ChatRemoteReposParams.cs | 10 - .../bindings/csharp/ChatRemoteReposResult.cs | 10 - agent/bindings/csharp/ChatRestoreParams.cs | 14 - agent/bindings/csharp/ChatSidebarNewResult.cs | 12 - agent/bindings/csharp/ChatWebNewResult.cs | 12 - agent/bindings/csharp/ClientCapabilities.cs | 48 ---- agent/bindings/csharp/ClientInfo.cs | 24 -- agent/bindings/csharp/ClientSideConfig.cs | 14 - .../bindings/csharp/CodeActionTriggerKind.cs | 13 - .../csharp/CodeActionsProvideParams.cs | 12 - .../csharp/CodeActionsProvideResult.cs | 10 - .../csharp/CodeActionsTriggerParams.cs | 10 - agent/bindings/csharp/CodyAgentClient.cs | 70 ----- agent/bindings/csharp/CodyAgentServer.cs | 178 ------------ agent/bindings/csharp/CodyCommand.cs | 24 -- agent/bindings/csharp/CodyCommandContext.cs | 26 -- agent/bindings/csharp/CodyCommandMode.cs | 15 - agent/bindings/csharp/CodyCommandType.cs | 19 -- .../bindings/csharp/CodyContextFilterItem.cs | 12 - agent/bindings/csharp/CodyError.cs | 14 - .../csharp/CodyLLMSiteConfiguration.cs | 24 -- agent/bindings/csharp/CodyTaskState.cs | 25 -- agent/bindings/csharp/CommandsCustomParams.cs | 10 - .../csharp/CompletionBookkeepingEvent.cs | 32 --- agent/bindings/csharp/CompletionItemInfo.cs | 26 -- agent/bindings/csharp/CompletionItemParams.cs | 10 - agent/bindings/csharp/CompletionLogID.cs | 12 - agent/bindings/csharp/Constants.cs | 94 ------- agent/bindings/csharp/ContextFilters.cs | 12 - agent/bindings/csharp/ContextItem.cs | 265 ------------------ agent/bindings/csharp/ContextItemSource.cs | 29 -- agent/bindings/csharp/ContextParams.cs | 10 - agent/bindings/csharp/CreateFilesParams.cs | 10 - .../csharp/CurrentUserCodySubscription.cs | 18 -- agent/bindings/csharp/CustomCommandResult.cs | 59 ---- agent/bindings/csharp/Date.cs | 6 - agent/bindings/csharp/DebugMessage.cs | 12 - .../bindings/csharp/DefiniteWebviewOptions.cs | 22 -- agent/bindings/csharp/DeleteFilesParams.cs | 10 - agent/bindings/csharp/DeleteOptionsParams.cs | 12 - agent/bindings/csharp/DiagnosticSeverity.cs | 17 -- .../csharp/DiagnosticsPublishParams.cs | 10 - agent/bindings/csharp/DisabledParams.cs | 10 - .../bindings/csharp/DisplayCodeLensParams.cs | 12 - .../bindings/csharp/EditCommandsCodeParams.cs | 24 -- agent/bindings/csharp/EditTask.cs | 22 -- agent/bindings/csharp/EditTaskAcceptParams.cs | 10 - agent/bindings/csharp/EditTaskCancelParams.cs | 10 - .../csharp/EditTaskGetTaskDetailsParams.cs | 10 - agent/bindings/csharp/EditTaskRetryParams.cs | 26 -- agent/bindings/csharp/EditTaskUndoParams.cs | 10 - agent/bindings/csharp/EndParams.cs | 12 - .../bindings/csharp/EnhancedContextParams.cs | 10 - .../bindings/csharp/EnvOpenExternalParams.cs | 10 - agent/bindings/csharp/Event.cs | 26 -- agent/bindings/csharp/EventProperties.cs | 22 -- agent/bindings/csharp/ExecuteCommandParams.cs | 12 - .../bindings/csharp/ExtensionConfiguration.cs | 36 --- .../FeatureFlagsGetFeatureFlagParams.cs | 10 - agent/bindings/csharp/FileIdentifier.cs | 10 - agent/bindings/csharp/FixupTaskID.cs | 12 - agent/bindings/csharp/GetDocumentsParams.cs | 10 - agent/bindings/csharp/GetDocumentsResult.cs | 10 - .../bindings/csharp/GetFoldingRangeParams.cs | 12 - .../bindings/csharp/GetFoldingRangeResult.cs | 10 - .../bindings/csharp/GitCodebaseNameParams.cs | 10 - ...GraphqlGetRepoIdIfEmbeddingExistsParams.cs | 10 - .../bindings/csharp/GraphqlGetRepoIdParams.cs | 10 - .../csharp/GraphqlGetRepoIdsParams.cs | 12 - .../csharp/GraphqlGetRepoIdsResult.cs | 10 - agent/bindings/csharp/IconsParams.cs | 12 - agent/bindings/csharp/IgnoreTestParams.cs | 10 - agent/bindings/csharp/IgnoreTestResult.cs | 18 -- agent/bindings/csharp/MemoryUsage.cs | 18 -- agent/bindings/csharp/MentionParams.cs | 14 - agent/bindings/csharp/MessageOptions.cs | 12 - agent/bindings/csharp/Model.cs | 24 -- agent/bindings/csharp/ModelContextWindow.cs | 14 - agent/bindings/csharp/ModelId.cs | 12 - agent/bindings/csharp/ModelRef.cs | 14 - agent/bindings/csharp/ModelTag.cs | 37 --- agent/bindings/csharp/ModelUsage.cs | 15 - agent/bindings/csharp/NetworkRequest.cs | 14 - agent/bindings/csharp/NodeTypesParams.cs | 18 -- .../csharp/NodeTypesWithCompletionParams.cs | 18 -- agent/bindings/csharp/Null.cs | 4 - agent/bindings/csharp/OpenAICompatible.cs | 52 ---- agent/bindings/csharp/OptionsParams.cs | 12 - agent/bindings/csharp/PortMappingParams.cs | 12 - agent/bindings/csharp/Position.cs | 12 - agent/bindings/csharp/ProgressCancelParams.cs | 10 - agent/bindings/csharp/ProgressEndParams.cs | 10 - agent/bindings/csharp/ProgressOptions.cs | 16 -- agent/bindings/csharp/ProgressReportParams.cs | 14 - agent/bindings/csharp/ProgressStartParams.cs | 12 - agent/bindings/csharp/ProtocolCodeAction.cs | 22 -- agent/bindings/csharp/ProtocolCodeLens.cs | 14 - agent/bindings/csharp/ProtocolCommand.cs | 16 -- agent/bindings/csharp/ProtocolDiagnostic.cs | 20 -- agent/bindings/csharp/ProtocolLocation.cs | 12 - .../ProtocolRelatedInformationDiagnostic.cs | 12 - agent/bindings/csharp/ProtocolTextDocument.cs | 22 -- .../ProtocolTextDocumentContentChangeEvent.cs | 12 - agent/bindings/csharp/ProtocolTypeAdapters.cs | 12 - agent/bindings/csharp/ProviderId.cs | 12 - agent/bindings/csharp/Range.cs | 12 - agent/bindings/csharp/RangeData.cs | 12 - agent/bindings/csharp/RemoteRepoFetchState.cs | 24 -- agent/bindings/csharp/RemoteRepoHasParams.cs | 10 - agent/bindings/csharp/RemoteRepoHasResult.cs | 10 - agent/bindings/csharp/RemoteRepoListParams.cs | 14 - agent/bindings/csharp/RemoteRepoListResult.cs | 16 -- agent/bindings/csharp/RenameFile.cs | 12 - agent/bindings/csharp/RenameFilesParams.cs | 10 - agent/bindings/csharp/Repo.cs | 12 - agent/bindings/csharp/ReposParams.cs | 12 - .../csharp/SaveDialogOptionsParams.cs | 16 -- .../bindings/csharp/SelectedCompletionInfo.cs | 12 - agent/bindings/csharp/SelectedReposParams.cs | 12 - .../csharp/SerializedChatInteraction.cs | 12 - .../bindings/csharp/SerializedChatMessage.cs | 30 -- .../csharp/SerializedChatTranscript.cs | 18 -- agent/bindings/csharp/ServerInfo.cs | 18 -- agent/bindings/csharp/ShowOptionsParams.cs | 12 - .../csharp/ShowWindowMessageParams.cs | 26 -- agent/bindings/csharp/SourceParams.cs | 12 - agent/bindings/csharp/StartParams.cs | 12 - agent/bindings/csharp/SymbolKind.cs | 15 - agent/bindings/csharp/TelemetryEvent.cs | 12 - .../csharp/TestingClosestPostDataParams.cs | 12 - .../csharp/TestingClosestPostDataResult.cs | 10 - .../csharp/TestingDiagnosticsParams.cs | 10 - .../csharp/TestingDiagnosticsResult.cs | 10 - .../TestingExportedTelemetryEventsResult.cs | 10 - .../csharp/TestingMemoryUsageResult.cs | 10 - .../csharp/TestingNetworkRequestsResult.cs | 10 - agent/bindings/csharp/TestingParams.cs | 12 - .../TestingProgressCancelationParams.cs | 10 - .../TestingProgressCancelationResult.cs | 10 - .../bindings/csharp/TestingProgressParams.cs | 10 - .../bindings/csharp/TestingProgressResult.cs | 10 - .../csharp/TestingRequestErrorsResult.cs | 10 - .../bindings/csharp/TestingTelemetryEvent.cs | 18 -- .../csharp/TextDocumentChangeResult.cs | 10 - .../csharp/TextDocumentDidFocusParams.cs | 10 - .../csharp/TextDocumentDidSaveParams.cs | 10 - .../bindings/csharp/TextDocumentEditParams.cs | 14 - .../csharp/TextDocumentShowOptionsParams.cs | 14 - .../bindings/csharp/TextDocumentShowParams.cs | 12 - agent/bindings/csharp/TextEdit.cs | 85 ------ agent/bindings/csharp/TitleParams.cs | 12 - agent/bindings/csharp/UntitledTextDocument.cs | 14 - agent/bindings/csharp/Uri.cs | 20 -- .../WebviewCreateWebviewPanelOptions.cs | 22 -- .../csharp/WebviewCreateWebviewPanelParams.cs | 18 -- .../csharp/WebviewDidDisposeNativeParams.cs | 10 - .../csharp/WebviewDidDisposeParams.cs | 10 - agent/bindings/csharp/WebviewDisposeParams.cs | 10 - .../csharp/WebviewNativeConfigParams.cs | 28 -- .../WebviewPostMessageStringEncodedParams.cs | 12 - ...ebviewReceiveMessageStringEncodedParams.cs | 12 - ...ebviewRegisterWebviewViewProviderParams.cs | 12 - .../csharp/WebviewResolveWebviewViewParams.cs | 12 - agent/bindings/csharp/WebviewRevealParams.cs | 14 - agent/bindings/csharp/WebviewSetHtmlParams.cs | 12 - .../csharp/WebviewSetIconPathParams.cs | 12 - .../csharp/WebviewSetOptionsParams.cs | 12 - .../bindings/csharp/WebviewSetTitleParams.cs | 12 - .../csharp/WindowDidChangeContextParams.cs | 12 - .../csharp/WorkspaceEditEntryMetadata.cs | 16 -- .../bindings/csharp/WorkspaceEditMetadata.cs | 10 - .../bindings/csharp/WorkspaceEditOperation.cs | 85 ------ agent/bindings/csharp/WorkspaceEditParams.cs | 12 - .../csharp/WorkspaceFolderDidChangeParams.cs | 10 - agent/bindings/csharp/WriteFileOptions.cs | 12 - .../scip-codegen/emitters/CSharpEmitter.ts | 144 ++++++---- 190 files changed, 83 insertions(+), 3584 deletions(-) delete mode 100644 agent/bindings/csharp/ApiVersionId.cs delete mode 100644 agent/bindings/csharp/AttributionSearchParams.cs delete mode 100644 agent/bindings/csharp/AttributionSearchResult.cs delete mode 100644 agent/bindings/csharp/AuthStatus.cs delete mode 100644 agent/bindings/csharp/AutocompleteItem.cs delete mode 100644 agent/bindings/csharp/AutocompleteParams.cs delete mode 100644 agent/bindings/csharp/AutocompleteResult.cs delete mode 100644 agent/bindings/csharp/CancelParams.cs delete mode 100644 agent/bindings/csharp/ChatDeleteParams.cs delete mode 100644 agent/bindings/csharp/ChatError.cs delete mode 100644 agent/bindings/csharp/ChatExportParams.cs delete mode 100644 agent/bindings/csharp/ChatExportResult.cs delete mode 100644 agent/bindings/csharp/ChatModelsParams.cs delete mode 100644 agent/bindings/csharp/ChatModelsResult.cs delete mode 100644 agent/bindings/csharp/ChatRemoteReposParams.cs delete mode 100644 agent/bindings/csharp/ChatRemoteReposResult.cs delete mode 100644 agent/bindings/csharp/ChatRestoreParams.cs delete mode 100644 agent/bindings/csharp/ChatSidebarNewResult.cs delete mode 100644 agent/bindings/csharp/ChatWebNewResult.cs delete mode 100644 agent/bindings/csharp/ClientCapabilities.cs delete mode 100644 agent/bindings/csharp/ClientInfo.cs delete mode 100644 agent/bindings/csharp/ClientSideConfig.cs delete mode 100644 agent/bindings/csharp/CodeActionTriggerKind.cs delete mode 100644 agent/bindings/csharp/CodeActionsProvideParams.cs delete mode 100644 agent/bindings/csharp/CodeActionsProvideResult.cs delete mode 100644 agent/bindings/csharp/CodeActionsTriggerParams.cs delete mode 100644 agent/bindings/csharp/CodyAgentClient.cs delete mode 100644 agent/bindings/csharp/CodyAgentServer.cs delete mode 100644 agent/bindings/csharp/CodyCommand.cs delete mode 100644 agent/bindings/csharp/CodyCommandContext.cs delete mode 100644 agent/bindings/csharp/CodyCommandMode.cs delete mode 100644 agent/bindings/csharp/CodyCommandType.cs delete mode 100644 agent/bindings/csharp/CodyContextFilterItem.cs delete mode 100644 agent/bindings/csharp/CodyError.cs delete mode 100644 agent/bindings/csharp/CodyLLMSiteConfiguration.cs delete mode 100644 agent/bindings/csharp/CodyTaskState.cs delete mode 100644 agent/bindings/csharp/CommandsCustomParams.cs delete mode 100644 agent/bindings/csharp/CompletionBookkeepingEvent.cs delete mode 100644 agent/bindings/csharp/CompletionItemInfo.cs delete mode 100644 agent/bindings/csharp/CompletionItemParams.cs delete mode 100644 agent/bindings/csharp/CompletionLogID.cs delete mode 100644 agent/bindings/csharp/Constants.cs delete mode 100644 agent/bindings/csharp/ContextFilters.cs delete mode 100644 agent/bindings/csharp/ContextItem.cs delete mode 100644 agent/bindings/csharp/ContextItemSource.cs delete mode 100644 agent/bindings/csharp/ContextParams.cs delete mode 100644 agent/bindings/csharp/CreateFilesParams.cs delete mode 100644 agent/bindings/csharp/CurrentUserCodySubscription.cs delete mode 100644 agent/bindings/csharp/CustomCommandResult.cs delete mode 100644 agent/bindings/csharp/Date.cs delete mode 100644 agent/bindings/csharp/DebugMessage.cs delete mode 100644 agent/bindings/csharp/DefiniteWebviewOptions.cs delete mode 100644 agent/bindings/csharp/DeleteFilesParams.cs delete mode 100644 agent/bindings/csharp/DeleteOptionsParams.cs delete mode 100644 agent/bindings/csharp/DiagnosticSeverity.cs delete mode 100644 agent/bindings/csharp/DiagnosticsPublishParams.cs delete mode 100644 agent/bindings/csharp/DisabledParams.cs delete mode 100644 agent/bindings/csharp/DisplayCodeLensParams.cs delete mode 100644 agent/bindings/csharp/EditCommandsCodeParams.cs delete mode 100644 agent/bindings/csharp/EditTask.cs delete mode 100644 agent/bindings/csharp/EditTaskAcceptParams.cs delete mode 100644 agent/bindings/csharp/EditTaskCancelParams.cs delete mode 100644 agent/bindings/csharp/EditTaskGetTaskDetailsParams.cs delete mode 100644 agent/bindings/csharp/EditTaskRetryParams.cs delete mode 100644 agent/bindings/csharp/EditTaskUndoParams.cs delete mode 100644 agent/bindings/csharp/EndParams.cs delete mode 100644 agent/bindings/csharp/EnhancedContextParams.cs delete mode 100644 agent/bindings/csharp/EnvOpenExternalParams.cs delete mode 100644 agent/bindings/csharp/Event.cs delete mode 100644 agent/bindings/csharp/EventProperties.cs delete mode 100644 agent/bindings/csharp/ExecuteCommandParams.cs delete mode 100644 agent/bindings/csharp/ExtensionConfiguration.cs delete mode 100644 agent/bindings/csharp/FeatureFlagsGetFeatureFlagParams.cs delete mode 100644 agent/bindings/csharp/FileIdentifier.cs delete mode 100644 agent/bindings/csharp/FixupTaskID.cs delete mode 100644 agent/bindings/csharp/GetDocumentsParams.cs delete mode 100644 agent/bindings/csharp/GetDocumentsResult.cs delete mode 100644 agent/bindings/csharp/GetFoldingRangeParams.cs delete mode 100644 agent/bindings/csharp/GetFoldingRangeResult.cs delete mode 100644 agent/bindings/csharp/GitCodebaseNameParams.cs delete mode 100644 agent/bindings/csharp/GraphqlGetRepoIdIfEmbeddingExistsParams.cs delete mode 100644 agent/bindings/csharp/GraphqlGetRepoIdParams.cs delete mode 100644 agent/bindings/csharp/GraphqlGetRepoIdsParams.cs delete mode 100644 agent/bindings/csharp/GraphqlGetRepoIdsResult.cs delete mode 100644 agent/bindings/csharp/IconsParams.cs delete mode 100644 agent/bindings/csharp/IgnoreTestParams.cs delete mode 100644 agent/bindings/csharp/IgnoreTestResult.cs delete mode 100644 agent/bindings/csharp/MemoryUsage.cs delete mode 100644 agent/bindings/csharp/MentionParams.cs delete mode 100644 agent/bindings/csharp/MessageOptions.cs delete mode 100644 agent/bindings/csharp/Model.cs delete mode 100644 agent/bindings/csharp/ModelContextWindow.cs delete mode 100644 agent/bindings/csharp/ModelId.cs delete mode 100644 agent/bindings/csharp/ModelRef.cs delete mode 100644 agent/bindings/csharp/ModelTag.cs delete mode 100644 agent/bindings/csharp/ModelUsage.cs delete mode 100644 agent/bindings/csharp/NetworkRequest.cs delete mode 100644 agent/bindings/csharp/NodeTypesParams.cs delete mode 100644 agent/bindings/csharp/NodeTypesWithCompletionParams.cs delete mode 100644 agent/bindings/csharp/Null.cs delete mode 100644 agent/bindings/csharp/OpenAICompatible.cs delete mode 100644 agent/bindings/csharp/OptionsParams.cs delete mode 100644 agent/bindings/csharp/PortMappingParams.cs delete mode 100644 agent/bindings/csharp/Position.cs delete mode 100644 agent/bindings/csharp/ProgressCancelParams.cs delete mode 100644 agent/bindings/csharp/ProgressEndParams.cs delete mode 100644 agent/bindings/csharp/ProgressOptions.cs delete mode 100644 agent/bindings/csharp/ProgressReportParams.cs delete mode 100644 agent/bindings/csharp/ProgressStartParams.cs delete mode 100644 agent/bindings/csharp/ProtocolCodeAction.cs delete mode 100644 agent/bindings/csharp/ProtocolCodeLens.cs delete mode 100644 agent/bindings/csharp/ProtocolCommand.cs delete mode 100644 agent/bindings/csharp/ProtocolDiagnostic.cs delete mode 100644 agent/bindings/csharp/ProtocolLocation.cs delete mode 100644 agent/bindings/csharp/ProtocolRelatedInformationDiagnostic.cs delete mode 100644 agent/bindings/csharp/ProtocolTextDocument.cs delete mode 100644 agent/bindings/csharp/ProtocolTextDocumentContentChangeEvent.cs delete mode 100644 agent/bindings/csharp/ProtocolTypeAdapters.cs delete mode 100644 agent/bindings/csharp/ProviderId.cs delete mode 100644 agent/bindings/csharp/Range.cs delete mode 100644 agent/bindings/csharp/RangeData.cs delete mode 100644 agent/bindings/csharp/RemoteRepoFetchState.cs delete mode 100644 agent/bindings/csharp/RemoteRepoHasParams.cs delete mode 100644 agent/bindings/csharp/RemoteRepoHasResult.cs delete mode 100644 agent/bindings/csharp/RemoteRepoListParams.cs delete mode 100644 agent/bindings/csharp/RemoteRepoListResult.cs delete mode 100644 agent/bindings/csharp/RenameFile.cs delete mode 100644 agent/bindings/csharp/RenameFilesParams.cs delete mode 100644 agent/bindings/csharp/Repo.cs delete mode 100644 agent/bindings/csharp/ReposParams.cs delete mode 100644 agent/bindings/csharp/SaveDialogOptionsParams.cs delete mode 100644 agent/bindings/csharp/SelectedCompletionInfo.cs delete mode 100644 agent/bindings/csharp/SelectedReposParams.cs delete mode 100644 agent/bindings/csharp/SerializedChatInteraction.cs delete mode 100644 agent/bindings/csharp/SerializedChatMessage.cs delete mode 100644 agent/bindings/csharp/SerializedChatTranscript.cs delete mode 100644 agent/bindings/csharp/ServerInfo.cs delete mode 100644 agent/bindings/csharp/ShowOptionsParams.cs delete mode 100644 agent/bindings/csharp/ShowWindowMessageParams.cs delete mode 100644 agent/bindings/csharp/SourceParams.cs delete mode 100644 agent/bindings/csharp/StartParams.cs delete mode 100644 agent/bindings/csharp/SymbolKind.cs delete mode 100644 agent/bindings/csharp/TelemetryEvent.cs delete mode 100644 agent/bindings/csharp/TestingClosestPostDataParams.cs delete mode 100644 agent/bindings/csharp/TestingClosestPostDataResult.cs delete mode 100644 agent/bindings/csharp/TestingDiagnosticsParams.cs delete mode 100644 agent/bindings/csharp/TestingDiagnosticsResult.cs delete mode 100644 agent/bindings/csharp/TestingExportedTelemetryEventsResult.cs delete mode 100644 agent/bindings/csharp/TestingMemoryUsageResult.cs delete mode 100644 agent/bindings/csharp/TestingNetworkRequestsResult.cs delete mode 100644 agent/bindings/csharp/TestingParams.cs delete mode 100644 agent/bindings/csharp/TestingProgressCancelationParams.cs delete mode 100644 agent/bindings/csharp/TestingProgressCancelationResult.cs delete mode 100644 agent/bindings/csharp/TestingProgressParams.cs delete mode 100644 agent/bindings/csharp/TestingProgressResult.cs delete mode 100644 agent/bindings/csharp/TestingRequestErrorsResult.cs delete mode 100644 agent/bindings/csharp/TestingTelemetryEvent.cs delete mode 100644 agent/bindings/csharp/TextDocumentChangeResult.cs delete mode 100644 agent/bindings/csharp/TextDocumentDidFocusParams.cs delete mode 100644 agent/bindings/csharp/TextDocumentDidSaveParams.cs delete mode 100644 agent/bindings/csharp/TextDocumentEditParams.cs delete mode 100644 agent/bindings/csharp/TextDocumentShowOptionsParams.cs delete mode 100644 agent/bindings/csharp/TextDocumentShowParams.cs delete mode 100644 agent/bindings/csharp/TextEdit.cs delete mode 100644 agent/bindings/csharp/TitleParams.cs delete mode 100644 agent/bindings/csharp/UntitledTextDocument.cs delete mode 100644 agent/bindings/csharp/Uri.cs delete mode 100644 agent/bindings/csharp/WebviewCreateWebviewPanelOptions.cs delete mode 100644 agent/bindings/csharp/WebviewCreateWebviewPanelParams.cs delete mode 100644 agent/bindings/csharp/WebviewDidDisposeNativeParams.cs delete mode 100644 agent/bindings/csharp/WebviewDidDisposeParams.cs delete mode 100644 agent/bindings/csharp/WebviewDisposeParams.cs delete mode 100644 agent/bindings/csharp/WebviewNativeConfigParams.cs delete mode 100644 agent/bindings/csharp/WebviewPostMessageStringEncodedParams.cs delete mode 100644 agent/bindings/csharp/WebviewReceiveMessageStringEncodedParams.cs delete mode 100644 agent/bindings/csharp/WebviewRegisterWebviewViewProviderParams.cs delete mode 100644 agent/bindings/csharp/WebviewResolveWebviewViewParams.cs delete mode 100644 agent/bindings/csharp/WebviewRevealParams.cs delete mode 100644 agent/bindings/csharp/WebviewSetHtmlParams.cs delete mode 100644 agent/bindings/csharp/WebviewSetIconPathParams.cs delete mode 100644 agent/bindings/csharp/WebviewSetOptionsParams.cs delete mode 100644 agent/bindings/csharp/WebviewSetTitleParams.cs delete mode 100644 agent/bindings/csharp/WindowDidChangeContextParams.cs delete mode 100644 agent/bindings/csharp/WorkspaceEditEntryMetadata.cs delete mode 100644 agent/bindings/csharp/WorkspaceEditMetadata.cs delete mode 100644 agent/bindings/csharp/WorkspaceEditOperation.cs delete mode 100644 agent/bindings/csharp/WorkspaceEditParams.cs delete mode 100644 agent/bindings/csharp/WorkspaceFolderDidChangeParams.cs delete mode 100644 agent/bindings/csharp/WriteFileOptions.cs diff --git a/agent/bindings/csharp/ApiVersionId.cs b/agent/bindings/csharp/ApiVersionId.cs deleted file mode 100644 index 69d591cc9218..000000000000 --- a/agent/bindings/csharp/ApiVersionId.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ApiVersionId - { - public string Value { get; set; } - - public static implicit operator string(ApiVersionId value) => value.Value; - public static implicit operator ApiVersionId(string value) => new ApiVersionId { Value = value }; - } -} diff --git a/agent/bindings/csharp/AttributionSearchParams.cs b/agent/bindings/csharp/AttributionSearchParams.cs deleted file mode 100644 index 1abad0a93fbe..000000000000 --- a/agent/bindings/csharp/AttributionSearchParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class AttributionSearchParams - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - [JsonProperty(PropertyName = "snippet")] - public string Snippet { get; set; } - } -} diff --git a/agent/bindings/csharp/AttributionSearchResult.cs b/agent/bindings/csharp/AttributionSearchResult.cs deleted file mode 100644 index 8b5eef325ea5..000000000000 --- a/agent/bindings/csharp/AttributionSearchResult.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class AttributionSearchResult - { - [JsonProperty(PropertyName = "error")] - public string Error { get; set; } - [JsonProperty(PropertyName = "repoNames")] - public string[] RepoNames { get; set; } - [JsonProperty(PropertyName = "limitHit")] - public bool LimitHit { get; set; } - } -} diff --git a/agent/bindings/csharp/AuthStatus.cs b/agent/bindings/csharp/AuthStatus.cs deleted file mode 100644 index 7865dc469bb3..000000000000 --- a/agent/bindings/csharp/AuthStatus.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class AuthStatus - { - [JsonProperty(PropertyName = "username")] - public string Username { get; set; } - [JsonProperty(PropertyName = "endpoint")] - public string Endpoint { get; set; } - [JsonProperty(PropertyName = "isDotCom")] - public bool IsDotCom { get; set; } - [JsonProperty(PropertyName = "isLoggedIn")] - public bool IsLoggedIn { get; set; } - [JsonProperty(PropertyName = "isFireworksTracingEnabled")] - public bool IsFireworksTracingEnabled { get; set; } - [JsonProperty(PropertyName = "showInvalidAccessTokenError")] - public bool ShowInvalidAccessTokenError { get; set; } - [JsonProperty(PropertyName = "authenticated")] - public bool Authenticated { get; set; } - [JsonProperty(PropertyName = "hasVerifiedEmail")] - public bool HasVerifiedEmail { get; set; } - [JsonProperty(PropertyName = "requiresVerifiedEmail")] - public bool RequiresVerifiedEmail { get; set; } - [JsonProperty(PropertyName = "siteHasCodyEnabled")] - public bool SiteHasCodyEnabled { get; set; } - [JsonProperty(PropertyName = "siteVersion")] - public string SiteVersion { get; set; } - [JsonProperty(PropertyName = "codyApiVersion")] - public int CodyApiVersion { get; set; } - [JsonProperty(PropertyName = "configOverwrites")] - public CodyLLMSiteConfiguration ConfigOverwrites { get; set; } - [JsonProperty(PropertyName = "showNetworkError")] - public bool ShowNetworkError { get; set; } - [JsonProperty(PropertyName = "primaryEmail")] - public string PrimaryEmail { get; set; } - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; set; } - [JsonProperty(PropertyName = "avatarURL")] - public string AvatarURL { get; set; } - [JsonProperty(PropertyName = "userCanUpgrade")] - public bool UserCanUpgrade { get; set; } - [JsonProperty(PropertyName = "isOfflineMode")] - public bool IsOfflineMode { get; set; } - } -} diff --git a/agent/bindings/csharp/AutocompleteItem.cs b/agent/bindings/csharp/AutocompleteItem.cs deleted file mode 100644 index 3f370a2ebe9d..000000000000 --- a/agent/bindings/csharp/AutocompleteItem.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class AutocompleteItem - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - [JsonProperty(PropertyName = "insertText")] - public string InsertText { get; set; } - [JsonProperty(PropertyName = "range")] - public Range Range { get; set; } - } -} diff --git a/agent/bindings/csharp/AutocompleteParams.cs b/agent/bindings/csharp/AutocompleteParams.cs deleted file mode 100644 index 97e0a9ba06ea..000000000000 --- a/agent/bindings/csharp/AutocompleteParams.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class AutocompleteParams - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "filePath")] - public string FilePath { get; set; } - [JsonProperty(PropertyName = "position")] - public Position Position { get; set; } - [JsonProperty(PropertyName = "triggerKind")] - public TriggerKindEnum TriggerKind { get; set; } // Oneof: Automatic, Invoke - [JsonProperty(PropertyName = "selectedCompletionInfo")] - public SelectedCompletionInfo SelectedCompletionInfo { get; set; } - - public enum TriggerKindEnum - { - [EnumMember(Value = "Automatic")] - Automatic, - [EnumMember(Value = "Invoke")] - Invoke, - } - } -} diff --git a/agent/bindings/csharp/AutocompleteResult.cs b/agent/bindings/csharp/AutocompleteResult.cs deleted file mode 100644 index f260d5d3e0c0..000000000000 --- a/agent/bindings/csharp/AutocompleteResult.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class AutocompleteResult - { - [JsonProperty(PropertyName = "items")] - public AutocompleteItem[] Items { get; set; } - [JsonProperty(PropertyName = "completionEvent")] - public CompletionBookkeepingEvent CompletionEvent { get; set; } - } -} diff --git a/agent/bindings/csharp/CancelParams.cs b/agent/bindings/csharp/CancelParams.cs deleted file mode 100644 index 8439e02167ac..000000000000 --- a/agent/bindings/csharp/CancelParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CancelParams - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - } -} diff --git a/agent/bindings/csharp/ChatDeleteParams.cs b/agent/bindings/csharp/ChatDeleteParams.cs deleted file mode 100644 index 9fce6386afe8..000000000000 --- a/agent/bindings/csharp/ChatDeleteParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ChatDeleteParams - { - [JsonProperty(PropertyName = "chatId")] - public string ChatId { get; set; } - } -} diff --git a/agent/bindings/csharp/ChatError.cs b/agent/bindings/csharp/ChatError.cs deleted file mode 100644 index a3dcea415bdc..000000000000 --- a/agent/bindings/csharp/ChatError.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ChatError - { - [JsonProperty(PropertyName = "kind")] - public string Kind { get; set; } - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - [JsonProperty(PropertyName = "retryAfter")] - public string RetryAfter { get; set; } - [JsonProperty(PropertyName = "limit")] - public int Limit { get; set; } - [JsonProperty(PropertyName = "userMessage")] - public string UserMessage { get; set; } - [JsonProperty(PropertyName = "retryAfterDate")] - public Date RetryAfterDate { get; set; } - [JsonProperty(PropertyName = "retryAfterDateString")] - public string RetryAfterDateString { get; set; } - [JsonProperty(PropertyName = "retryMessage")] - public string RetryMessage { get; set; } - [JsonProperty(PropertyName = "feature")] - public string Feature { get; set; } - [JsonProperty(PropertyName = "upgradeIsAvailable")] - public bool UpgradeIsAvailable { get; set; } - [JsonProperty(PropertyName = "isChatErrorGuard")] - public IsChatErrorGuardEnum IsChatErrorGuard { get; set; } // Oneof: isChatErrorGuard - - public enum IsChatErrorGuardEnum - { - [EnumMember(Value = "isChatErrorGuard")] - IsChatErrorGuard, - } - } -} diff --git a/agent/bindings/csharp/ChatExportParams.cs b/agent/bindings/csharp/ChatExportParams.cs deleted file mode 100644 index 62897653cff9..000000000000 --- a/agent/bindings/csharp/ChatExportParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ChatExportParams - { - [JsonProperty(PropertyName = "fullHistory")] - public bool FullHistory { get; set; } - } -} diff --git a/agent/bindings/csharp/ChatExportResult.cs b/agent/bindings/csharp/ChatExportResult.cs deleted file mode 100644 index 1deccfbe97ba..000000000000 --- a/agent/bindings/csharp/ChatExportResult.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ChatExportResult - { - [JsonProperty(PropertyName = "chatID")] - public string ChatID { get; set; } - [JsonProperty(PropertyName = "transcript")] - public SerializedChatTranscript Transcript { get; set; } - } -} diff --git a/agent/bindings/csharp/ChatModelsParams.cs b/agent/bindings/csharp/ChatModelsParams.cs deleted file mode 100644 index 97ed09d1e29c..000000000000 --- a/agent/bindings/csharp/ChatModelsParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ChatModelsParams - { - [JsonProperty(PropertyName = "modelUsage")] - public ModelUsage ModelUsage { get; set; } // Oneof: chat, edit, autocomplete - } -} diff --git a/agent/bindings/csharp/ChatModelsResult.cs b/agent/bindings/csharp/ChatModelsResult.cs deleted file mode 100644 index 065f86d3c64d..000000000000 --- a/agent/bindings/csharp/ChatModelsResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ChatModelsResult - { - [JsonProperty(PropertyName = "models")] - public Model[] Models { get; set; } - } -} diff --git a/agent/bindings/csharp/ChatRemoteReposParams.cs b/agent/bindings/csharp/ChatRemoteReposParams.cs deleted file mode 100644 index 6719bb13f074..000000000000 --- a/agent/bindings/csharp/ChatRemoteReposParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ChatRemoteReposParams - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - } -} diff --git a/agent/bindings/csharp/ChatRemoteReposResult.cs b/agent/bindings/csharp/ChatRemoteReposResult.cs deleted file mode 100644 index 8f1fe6aa3d25..000000000000 --- a/agent/bindings/csharp/ChatRemoteReposResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ChatRemoteReposResult - { - [JsonProperty(PropertyName = "remoteRepos")] - public Repo[] RemoteRepos { get; set; } - } -} diff --git a/agent/bindings/csharp/ChatRestoreParams.cs b/agent/bindings/csharp/ChatRestoreParams.cs deleted file mode 100644 index 47f24dc8a549..000000000000 --- a/agent/bindings/csharp/ChatRestoreParams.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ChatRestoreParams - { - [JsonProperty(PropertyName = "modelID")] - public string ModelID { get; set; } - [JsonProperty(PropertyName = "messages")] - public SerializedChatMessage[] Messages { get; set; } - [JsonProperty(PropertyName = "chatID")] - public string ChatID { get; set; } - } -} diff --git a/agent/bindings/csharp/ChatSidebarNewResult.cs b/agent/bindings/csharp/ChatSidebarNewResult.cs deleted file mode 100644 index e67bf8eb6cc9..000000000000 --- a/agent/bindings/csharp/ChatSidebarNewResult.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ChatSidebarNewResult - { - [JsonProperty(PropertyName = "panelId")] - public string PanelId { get; set; } - [JsonProperty(PropertyName = "chatId")] - public string ChatId { get; set; } - } -} diff --git a/agent/bindings/csharp/ChatWebNewResult.cs b/agent/bindings/csharp/ChatWebNewResult.cs deleted file mode 100644 index 5630dae97b95..000000000000 --- a/agent/bindings/csharp/ChatWebNewResult.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ChatWebNewResult - { - [JsonProperty(PropertyName = "panelId")] - public string PanelId { get; set; } - [JsonProperty(PropertyName = "chatId")] - public string ChatId { get; set; } - } -} diff --git a/agent/bindings/csharp/ClientCapabilities.cs b/agent/bindings/csharp/ClientCapabilities.cs deleted file mode 100644 index c4f04df50ec2..000000000000 --- a/agent/bindings/csharp/ClientCapabilities.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ClientCapabilities - { - [JsonProperty(PropertyName = "completions")] - public CompletionsEnum Completions { get; set; } // Oneof: none - [JsonProperty(PropertyName = "chat")] - public ChatEnum Chat { get; set; } // Oneof: none, streaming - [JsonProperty(PropertyName = "git")] - public GitEnum Git { get; set; } // Oneof: none, enabled - [JsonProperty(PropertyName = "progressBars")] - public ProgressBarsEnum ProgressBars { get; set; } // Oneof: none, enabled - [JsonProperty(PropertyName = "edit")] - public EditEnum Edit { get; set; } // Oneof: none, enabled - [JsonProperty(PropertyName = "editWorkspace")] - public EditWorkspaceEnum EditWorkspace { get; set; } // Oneof: none, enabled - [JsonProperty(PropertyName = "untitledDocuments")] - public UntitledDocumentsEnum UntitledDocuments { get; set; } // Oneof: none, enabled - [JsonProperty(PropertyName = "showDocument")] - public ShowDocumentEnum ShowDocument { get; set; } // Oneof: none, enabled - [JsonProperty(PropertyName = "codeLenses")] - public CodeLensesEnum CodeLenses { get; set; } // Oneof: none, enabled - [JsonProperty(PropertyName = "showWindowMessage")] - public ShowWindowMessageEnum ShowWindowMessage { get; set; } // Oneof: notification, request - [JsonProperty(PropertyName = "ignore")] - public IgnoreEnum Ignore { get; set; } // Oneof: none, enabled - [JsonProperty(PropertyName = "codeActions")] - public CodeActionsEnum CodeActions { get; set; } // Oneof: none, enabled - [JsonProperty(PropertyName = "webviewMessages")] - public string WebviewMessages { get; set; } // Oneof: object-encoded, string-encoded - [JsonProperty(PropertyName = "globalState")] - public string GlobalState { get; set; } // Oneof: stateless, server-managed, client-managed - [JsonProperty(PropertyName = "webview")] - public WebviewEnum Webview { get; set; } // Oneof: agentic, native - [JsonProperty(PropertyName = "webviewNativeConfig")] - public WebviewNativeConfigParams WebviewNativeConfig { get; set; } - - public enum WebviewEnum - { - [EnumMember(Value = "agentic")] - Agentic, - [EnumMember(Value = "native")] - Native, - } - } -} diff --git a/agent/bindings/csharp/ClientInfo.cs b/agent/bindings/csharp/ClientInfo.cs deleted file mode 100644 index be70c1a760c2..000000000000 --- a/agent/bindings/csharp/ClientInfo.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ClientInfo - { - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - [JsonProperty(PropertyName = "version")] - public string Version { get; set; } - [JsonProperty(PropertyName = "ideVersion")] - public string IdeVersion { get; set; } - [JsonProperty(PropertyName = "workspaceRootUri")] - public string WorkspaceRootUri { get; set; } - [JsonProperty(PropertyName = "globalStateDir")] - public string GlobalStateDir { get; set; } - [JsonProperty(PropertyName = "workspaceRootPath")] - public string WorkspaceRootPath { get; set; } - [JsonProperty(PropertyName = "extensionConfiguration")] - public ExtensionConfiguration ExtensionConfiguration { get; set; } - [JsonProperty(PropertyName = "capabilities")] - public ClientCapabilities Capabilities { get; set; } - } -} diff --git a/agent/bindings/csharp/ClientSideConfig.cs b/agent/bindings/csharp/ClientSideConfig.cs deleted file mode 100644 index a6866d230332..000000000000 --- a/agent/bindings/csharp/ClientSideConfig.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ClientSideConfig - { - [JsonProperty(PropertyName = "apiKey")] - public string ApiKey { get; set; } - [JsonProperty(PropertyName = "apiEndpoint")] - public string ApiEndpoint { get; set; } - [JsonProperty(PropertyName = "openAICompatible")] - public OpenAICompatible OpenAICompatible { get; set; } - } -} diff --git a/agent/bindings/csharp/CodeActionTriggerKind.cs b/agent/bindings/csharp/CodeActionTriggerKind.cs deleted file mode 100644 index b1c767dbcd3b..000000000000 --- a/agent/bindings/csharp/CodeActionTriggerKind.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - - public enum CodeActionTriggerKind - { - [EnumMember(Value = "Invoke")] - Invoke, - [EnumMember(Value = "Automatic")] - Automatic, - } -} diff --git a/agent/bindings/csharp/CodeActionsProvideParams.cs b/agent/bindings/csharp/CodeActionsProvideParams.cs deleted file mode 100644 index dd457970645f..000000000000 --- a/agent/bindings/csharp/CodeActionsProvideParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CodeActionsProvideParams - { - [JsonProperty(PropertyName = "location")] - public ProtocolLocation Location { get; set; } - [JsonProperty(PropertyName = "triggerKind")] - public CodeActionTriggerKind TriggerKind { get; set; } // Oneof: Invoke, Automatic - } -} diff --git a/agent/bindings/csharp/CodeActionsProvideResult.cs b/agent/bindings/csharp/CodeActionsProvideResult.cs deleted file mode 100644 index 4c92ea6974dc..000000000000 --- a/agent/bindings/csharp/CodeActionsProvideResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CodeActionsProvideResult - { - [JsonProperty(PropertyName = "codeActions")] - public ProtocolCodeAction[] CodeActions { get; set; } - } -} diff --git a/agent/bindings/csharp/CodeActionsTriggerParams.cs b/agent/bindings/csharp/CodeActionsTriggerParams.cs deleted file mode 100644 index ec78e031328f..000000000000 --- a/agent/bindings/csharp/CodeActionsTriggerParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CodeActionsTriggerParams - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - } -} diff --git a/agent/bindings/csharp/CodyAgentClient.cs b/agent/bindings/csharp/CodyAgentClient.cs deleted file mode 100644 index 0aa5d7199a43..000000000000 --- a/agent/bindings/csharp/CodyAgentClient.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.Threading.Tasks; - -namespace Cody.Core.Agent.Protocol; -{ - -public interface CodyAgentClient -{ - // ======== - // Requests - // ======== - [JsonRpcMethod("window/showMessage")] - Task WindowShowMessage(ShowWindowMessageParams params); - [JsonRpcMethod("window/showSaveDialog")] - Task WindowShowSaveDialog(SaveDialogOptionsParams params); - [JsonRpcMethod("textDocument/edit")] - Task TextDocumentEdit(TextDocumentEditParams params); - [JsonRpcMethod("textDocument/openUntitledDocument")] - Task TextDocumentOpenUntitledDocument(UntitledTextDocument params); - [JsonRpcMethod("textDocument/show")] - Task TextDocumentShow(TextDocumentShowParams params); - [JsonRpcMethod("workspace/edit")] - Task WorkspaceEdit(WorkspaceEditParams params); - [JsonRpcMethod("env/openExternal")] - Task EnvOpenExternal(EnvOpenExternalParams params); - - // ============= - // Notifications - // ============= - [JsonRpcMethod("debug/message")] - void DebugMessage(DebugMessage params); - [JsonRpcMethod("editTask/didUpdate")] - void EditTaskDidUpdate(EditTask params); - [JsonRpcMethod("editTask/didDelete")] - void EditTaskDidDelete(EditTask params); - [JsonRpcMethod("codeLenses/display")] - void CodeLensesDisplay(DisplayCodeLensParams params); - [JsonRpcMethod("ignore/didChange")] - void IgnoreDidChange(Void params); - [JsonRpcMethod("webview/postMessageStringEncoded")] - void WebviewPostMessageStringEncoded(WebviewPostMessageStringEncodedParams params); - [JsonRpcMethod("progress/start")] - void ProgressStart(ProgressStartParams params); - [JsonRpcMethod("progress/report")] - void ProgressReport(ProgressReportParams params); - [JsonRpcMethod("progress/end")] - void ProgressEnd(ProgressEndParams params); - [JsonRpcMethod("remoteRepo/didChange")] - void RemoteRepoDidChange(Void params); - [JsonRpcMethod("remoteRepo/didChangeState")] - void RemoteRepoDidChangeState(RemoteRepoFetchState params); - [JsonRpcMethod("webview/registerWebviewViewProvider")] - void WebviewRegisterWebviewViewProvider(WebviewRegisterWebviewViewProviderParams params); - [JsonRpcMethod("webview/createWebviewPanel")] - void WebviewCreateWebviewPanel(WebviewCreateWebviewPanelParams params); - [JsonRpcMethod("webview/dispose")] - void WebviewDispose(WebviewDisposeParams params); - [JsonRpcMethod("webview/reveal")] - void WebviewReveal(WebviewRevealParams params); - [JsonRpcMethod("webview/setTitle")] - void WebviewSetTitle(WebviewSetTitleParams params); - [JsonRpcMethod("webview/setIconPath")] - void WebviewSetIconPath(WebviewSetIconPathParams params); - [JsonRpcMethod("webview/setOptions")] - void WebviewSetOptions(WebviewSetOptionsParams params); - [JsonRpcMethod("webview/setHtml")] - void WebviewSetHtml(WebviewSetHtmlParams params); - [JsonRpcMethod("window/didChangeContext")] - void WindowDidChangeContext(WindowDidChangeContextParams params); -} -} diff --git a/agent/bindings/csharp/CodyAgentServer.cs b/agent/bindings/csharp/CodyAgentServer.cs deleted file mode 100644 index efe1cdb820d4..000000000000 --- a/agent/bindings/csharp/CodyAgentServer.cs +++ /dev/null @@ -1,178 +0,0 @@ -using System.Threading.Tasks; - -namespace Cody.Core.Agent.Protocol; -{ - -public interface CodyAgentServer -{ - // ======== - // Requests - // ======== - [JsonRpcMethod("initialize")] - Task Initialize(ClientInfo params); - [JsonRpcMethod("shutdown")] - Task Shutdown(); - [JsonRpcMethod("chat/new")] - Task ChatNew(); - [JsonRpcMethod("chat/web/new")] - Task ChatWebNew(); - [JsonRpcMethod("chat/sidebar/new")] - Task ChatSidebarNew(); - [JsonRpcMethod("chat/delete")] - Task ChatDelete(ChatDeleteParams params); - [JsonRpcMethod("chat/restore")] - Task ChatRestore(ChatRestoreParams params); - [JsonRpcMethod("chat/models")] - Task ChatModels(ChatModelsParams params); - [JsonRpcMethod("chat/export")] - Task ChatExport(ChatExportParams params); - [JsonRpcMethod("chat/remoteRepos")] - Task ChatRemoteRepos(ChatRemoteReposParams params); - [JsonRpcMethod("commands/explain")] - Task CommandsExplain(); - [JsonRpcMethod("commands/test")] - Task CommandsTest(); - [JsonRpcMethod("commands/smell")] - Task CommandsSmell(); - [JsonRpcMethod("commands/custom")] - Task CommandsCustom(CommandsCustomParams params); - [JsonRpcMethod("customCommands/list")] - Task CustomCommandsList(); - [JsonRpcMethod("editCommands/code")] - Task EditCommandsCode(EditCommandsCodeParams params); - [JsonRpcMethod("editCommands/test")] - Task EditCommandsTest(); - [JsonRpcMethod("editCommands/document")] - Task EditCommandsDocument(); - [JsonRpcMethod("editTask/accept")] - Task EditTaskAccept(EditTaskAcceptParams params); - [JsonRpcMethod("editTask/undo")] - Task EditTaskUndo(EditTaskUndoParams params); - [JsonRpcMethod("editTask/cancel")] - Task EditTaskCancel(EditTaskCancelParams params); - [JsonRpcMethod("editTask/retry")] - Task EditTaskRetry(EditTaskRetryParams params); - [JsonRpcMethod("editTask/getTaskDetails")] - Task EditTaskGetTaskDetails(EditTaskGetTaskDetailsParams params); - [JsonRpcMethod("editTask/getFoldingRanges")] - Task EditTaskGetFoldingRanges(GetFoldingRangeParams params); - [JsonRpcMethod("command/execute")] - Task CommandExecute(ExecuteCommandParams params); - [JsonRpcMethod("codeActions/provide")] - Task CodeActionsProvide(CodeActionsProvideParams params); - [JsonRpcMethod("codeActions/trigger")] - Task CodeActionsTrigger(CodeActionsTriggerParams params); - [JsonRpcMethod("autocomplete/execute")] - Task AutocompleteExecute(AutocompleteParams params); - [JsonRpcMethod("graphql/getRepoIds")] - Task GraphqlGetRepoIds(GraphqlGetRepoIdsParams params); - [JsonRpcMethod("graphql/currentUserId")] - Task GraphqlCurrentUserId(); - [JsonRpcMethod("graphql/currentUserIsPro")] - Task GraphqlCurrentUserIsPro(); - [JsonRpcMethod("featureFlags/getFeatureFlag")] - Task FeatureFlagsGetFeatureFlag(FeatureFlagsGetFeatureFlagParams params); - [JsonRpcMethod("graphql/getCurrentUserCodySubscription")] - Task GraphqlGetCurrentUserCodySubscription(); - [JsonRpcMethod("graphql/logEvent")] - Task GraphqlLogEvent(Event params); - [JsonRpcMethod("telemetry/recordEvent")] - Task TelemetryRecordEvent(TelemetryEvent params); - [JsonRpcMethod("graphql/getRepoIdIfEmbeddingExists")] - Task GraphqlGetRepoIdIfEmbeddingExists(GraphqlGetRepoIdIfEmbeddingExistsParams params); - [JsonRpcMethod("graphql/getRepoId")] - Task GraphqlGetRepoId(GraphqlGetRepoIdParams params); - [JsonRpcMethod("git/codebaseName")] - Task GitCodebaseName(GitCodebaseNameParams params); - [JsonRpcMethod("webview/didDispose")] - Task WebviewDidDispose(WebviewDidDisposeParams params); - [JsonRpcMethod("webview/resolveWebviewView")] - Task WebviewResolveWebviewView(WebviewResolveWebviewViewParams params); - [JsonRpcMethod("webview/receiveMessageStringEncoded")] - Task WebviewReceiveMessageStringEncoded(WebviewReceiveMessageStringEncodedParams params); - [JsonRpcMethod("diagnostics/publish")] - Task DiagnosticsPublish(DiagnosticsPublishParams params); - [JsonRpcMethod("testing/progress")] - Task TestingProgress(TestingProgressParams params); - [JsonRpcMethod("testing/exportedTelemetryEvents")] - Task TestingExportedTelemetryEvents(); - [JsonRpcMethod("testing/networkRequests")] - Task TestingNetworkRequests(); - [JsonRpcMethod("testing/requestErrors")] - Task TestingRequestErrors(); - [JsonRpcMethod("testing/closestPostData")] - Task TestingClosestPostData(TestingClosestPostDataParams params); - [JsonRpcMethod("testing/memoryUsage")] - Task TestingMemoryUsage(); - [JsonRpcMethod("testing/awaitPendingPromises")] - Task TestingAwaitPendingPromises(); - [JsonRpcMethod("testing/workspaceDocuments")] - Task TestingWorkspaceDocuments(GetDocumentsParams params); - [JsonRpcMethod("testing/diagnostics")] - Task TestingDiagnostics(TestingDiagnosticsParams params); - [JsonRpcMethod("testing/progressCancelation")] - Task TestingProgressCancelation(TestingProgressCancelationParams params); - [JsonRpcMethod("testing/reset")] - Task TestingReset(); - [JsonRpcMethod("testing/autocomplete/completionEvent")] - Task TestingAutocompleteCompletionEvent(CompletionItemParams params); - [JsonRpcMethod("extensionConfiguration/change")] - Task ExtensionConfigurationChange(ExtensionConfiguration params); - [JsonRpcMethod("extensionConfiguration/status")] - Task ExtensionConfigurationStatus(); - [JsonRpcMethod("extensionConfiguration/getSettingsSchema")] - Task ExtensionConfigurationGetSettingsSchema(); - [JsonRpcMethod("textDocument/change")] - Task TextDocumentChange(ProtocolTextDocument params); - [JsonRpcMethod("attribution/search")] - Task AttributionSearch(AttributionSearchParams params); - [JsonRpcMethod("ignore/test")] - Task IgnoreTest(IgnoreTestParams params); - [JsonRpcMethod("testing/ignore/overridePolicy")] - Task TestingIgnoreOverridePolicy(ContextFilters params); - [JsonRpcMethod("remoteRepo/has")] - Task RemoteRepoHas(RemoteRepoHasParams params); - [JsonRpcMethod("remoteRepo/list")] - Task RemoteRepoList(RemoteRepoListParams params); - - // ============= - // Notifications - // ============= - [JsonRpcMethod("initialized")] - void Initialized(Void params); - [JsonRpcMethod("exit")] - void Exit(Void params); - [JsonRpcMethod("extensionConfiguration/didChange")] - void ExtensionConfigurationDidChange(ExtensionConfiguration params); - [JsonRpcMethod("workspaceFolder/didChange")] - void WorkspaceFolderDidChange(WorkspaceFolderDidChangeParams params); - [JsonRpcMethod("textDocument/didOpen")] - void TextDocumentDidOpen(ProtocolTextDocument params); - [JsonRpcMethod("textDocument/didChange")] - void TextDocumentDidChange(ProtocolTextDocument params); - [JsonRpcMethod("textDocument/didFocus")] - void TextDocumentDidFocus(TextDocumentDidFocusParams params); - [JsonRpcMethod("textDocument/didSave")] - void TextDocumentDidSave(TextDocumentDidSaveParams params); - [JsonRpcMethod("textDocument/didClose")] - void TextDocumentDidClose(ProtocolTextDocument params); - [JsonRpcMethod("workspace/didDeleteFiles")] - void WorkspaceDidDeleteFiles(DeleteFilesParams params); - [JsonRpcMethod("workspace/didCreateFiles")] - void WorkspaceDidCreateFiles(CreateFilesParams params); - [JsonRpcMethod("workspace/didRenameFiles")] - void WorkspaceDidRenameFiles(RenameFilesParams params); - [JsonRpcMethod("$/cancelRequest")] - void CancelRequest(CancelParams params); - [JsonRpcMethod("autocomplete/clearLastCandidate")] - void AutocompleteClearLastCandidate(Void params); - [JsonRpcMethod("autocomplete/completionSuggested")] - void AutocompleteCompletionSuggested(CompletionItemParams params); - [JsonRpcMethod("autocomplete/completionAccepted")] - void AutocompleteCompletionAccepted(CompletionItemParams params); - [JsonRpcMethod("progress/cancel")] - void ProgressCancel(ProgressCancelParams params); - [JsonRpcMethod("webview/didDisposeNative")] - void WebviewDidDisposeNative(WebviewDidDisposeNativeParams params); -} -} diff --git a/agent/bindings/csharp/CodyCommand.cs b/agent/bindings/csharp/CodyCommand.cs deleted file mode 100644 index 90893fb0c13d..000000000000 --- a/agent/bindings/csharp/CodyCommand.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CodyCommand - { - [JsonProperty(PropertyName = "slashCommand")] - public string SlashCommand { get; set; } - [JsonProperty(PropertyName = "key")] - public string Key { get; set; } - [JsonProperty(PropertyName = "prompt")] - public string Prompt { get; set; } - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - [JsonProperty(PropertyName = "context")] - public CodyCommandContext Context { get; set; } - [JsonProperty(PropertyName = "type")] - public CodyCommandType Type { get; set; } // Oneof: workspace, user, default, experimental, recently used - [JsonProperty(PropertyName = "mode")] - public CodyCommandMode Mode { get; set; } // Oneof: ask, edit, insert - [JsonProperty(PropertyName = "requestID")] - public string RequestID { get; set; } - } -} diff --git a/agent/bindings/csharp/CodyCommandContext.cs b/agent/bindings/csharp/CodyCommandContext.cs deleted file mode 100644 index d01f31f0fec8..000000000000 --- a/agent/bindings/csharp/CodyCommandContext.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CodyCommandContext - { - [JsonProperty(PropertyName = "none")] - public bool None { get; set; } - [JsonProperty(PropertyName = "openTabs")] - public bool OpenTabs { get; set; } - [JsonProperty(PropertyName = "currentDir")] - public bool CurrentDir { get; set; } - [JsonProperty(PropertyName = "currentFile")] - public bool CurrentFile { get; set; } - [JsonProperty(PropertyName = "selection")] - public bool Selection { get; set; } - [JsonProperty(PropertyName = "command")] - public string Command { get; set; } - [JsonProperty(PropertyName = "filePath")] - public string FilePath { get; set; } - [JsonProperty(PropertyName = "directoryPath")] - public string DirectoryPath { get; set; } - [JsonProperty(PropertyName = "codebase")] - public bool Codebase { get; set; } - } -} diff --git a/agent/bindings/csharp/CodyCommandMode.cs b/agent/bindings/csharp/CodyCommandMode.cs deleted file mode 100644 index 7c9432cfdcf7..000000000000 --- a/agent/bindings/csharp/CodyCommandMode.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - - public enum CodyCommandMode - { - [EnumMember(Value = "ask")] - Ask, - [EnumMember(Value = "edit")] - Edit, - [EnumMember(Value = "insert")] - Insert, - } -} diff --git a/agent/bindings/csharp/CodyCommandType.cs b/agent/bindings/csharp/CodyCommandType.cs deleted file mode 100644 index 6fdeb2de894b..000000000000 --- a/agent/bindings/csharp/CodyCommandType.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - - public enum CodyCommandType - { - [EnumMember(Value = "workspace")] - Workspace, - [EnumMember(Value = "user")] - User, - [EnumMember(Value = "default")] - Default, - [EnumMember(Value = "experimental")] - Experimental, - [EnumMember(Value = "recently used")] - Recently used, - } -} diff --git a/agent/bindings/csharp/CodyContextFilterItem.cs b/agent/bindings/csharp/CodyContextFilterItem.cs deleted file mode 100644 index f538fc97e04e..000000000000 --- a/agent/bindings/csharp/CodyContextFilterItem.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CodyContextFilterItem - { - [JsonProperty(PropertyName = "repoNamePattern")] - public string RepoNamePattern { get; set; } - [JsonProperty(PropertyName = "filePathPatterns")] - public string[] FilePathPatterns { get; set; } - } -} diff --git a/agent/bindings/csharp/CodyError.cs b/agent/bindings/csharp/CodyError.cs deleted file mode 100644 index e36cb6487f86..000000000000 --- a/agent/bindings/csharp/CodyError.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CodyError - { - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - [JsonProperty(PropertyName = "cause")] - public CodyError Cause { get; set; } - [JsonProperty(PropertyName = "stack")] - public string Stack { get; set; } - } -} diff --git a/agent/bindings/csharp/CodyLLMSiteConfiguration.cs b/agent/bindings/csharp/CodyLLMSiteConfiguration.cs deleted file mode 100644 index e7cc963ef858..000000000000 --- a/agent/bindings/csharp/CodyLLMSiteConfiguration.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CodyLLMSiteConfiguration - { - [JsonProperty(PropertyName = "chatModel")] - public string ChatModel { get; set; } - [JsonProperty(PropertyName = "chatModelMaxTokens")] - public int ChatModelMaxTokens { get; set; } - [JsonProperty(PropertyName = "fastChatModel")] - public string FastChatModel { get; set; } - [JsonProperty(PropertyName = "fastChatModelMaxTokens")] - public int FastChatModelMaxTokens { get; set; } - [JsonProperty(PropertyName = "completionModel")] - public string CompletionModel { get; set; } - [JsonProperty(PropertyName = "completionModelMaxTokens")] - public int CompletionModelMaxTokens { get; set; } - [JsonProperty(PropertyName = "provider")] - public string Provider { get; set; } - [JsonProperty(PropertyName = "smartContextWindow")] - public bool SmartContextWindow { get; set; } - } -} diff --git a/agent/bindings/csharp/CodyTaskState.cs b/agent/bindings/csharp/CodyTaskState.cs deleted file mode 100644 index 12f3ef333a4f..000000000000 --- a/agent/bindings/csharp/CodyTaskState.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - - public enum CodyTaskState - { - [EnumMember(Value = "Idle")] - Idle, - [EnumMember(Value = "Working")] - Working, - [EnumMember(Value = "Inserting")] - Inserting, - [EnumMember(Value = "Applying")] - Applying, - [EnumMember(Value = "Applied")] - Applied, - [EnumMember(Value = "Finished")] - Finished, - [EnumMember(Value = "Error")] - Error, - [EnumMember(Value = "Pending")] - Pending, - } -} diff --git a/agent/bindings/csharp/CommandsCustomParams.cs b/agent/bindings/csharp/CommandsCustomParams.cs deleted file mode 100644 index 1a165865cb36..000000000000 --- a/agent/bindings/csharp/CommandsCustomParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CommandsCustomParams - { - [JsonProperty(PropertyName = "key")] - public string Key { get; set; } - } -} diff --git a/agent/bindings/csharp/CompletionBookkeepingEvent.cs b/agent/bindings/csharp/CompletionBookkeepingEvent.cs deleted file mode 100644 index 96b4666b4771..000000000000 --- a/agent/bindings/csharp/CompletionBookkeepingEvent.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CompletionBookkeepingEvent - { - [JsonProperty(PropertyName = "id")] - public CompletionLogID Id { get; set; } - [JsonProperty(PropertyName = "startedAt")] - public int StartedAt { get; set; } - [JsonProperty(PropertyName = "networkRequestStartedAt")] - public int NetworkRequestStartedAt { get; set; } - [JsonProperty(PropertyName = "startLoggedAt")] - public int StartLoggedAt { get; set; } - [JsonProperty(PropertyName = "loadedAt")] - public int LoadedAt { get; set; } - [JsonProperty(PropertyName = "suggestedAt")] - public int SuggestedAt { get; set; } - [JsonProperty(PropertyName = "suggestionLoggedAt")] - public int SuggestionLoggedAt { get; set; } - [JsonProperty(PropertyName = "suggestionAnalyticsLoggedAt")] - public int SuggestionAnalyticsLoggedAt { get; set; } - [JsonProperty(PropertyName = "acceptedAt")] - public int AcceptedAt { get; set; } - [JsonProperty(PropertyName = "items")] - public CompletionItemInfo[] Items { get; set; } - [JsonProperty(PropertyName = "loggedPartialAcceptedLength")] - public int LoggedPartialAcceptedLength { get; set; } - [JsonProperty(PropertyName = "read")] - public bool Read { get; set; } - } -} diff --git a/agent/bindings/csharp/CompletionItemInfo.cs b/agent/bindings/csharp/CompletionItemInfo.cs deleted file mode 100644 index 04e663875f42..000000000000 --- a/agent/bindings/csharp/CompletionItemInfo.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CompletionItemInfo - { - [JsonProperty(PropertyName = "parseErrorCount")] - public int ParseErrorCount { get; set; } - [JsonProperty(PropertyName = "lineTruncatedCount")] - public int LineTruncatedCount { get; set; } - [JsonProperty(PropertyName = "truncatedWith")] - public string TruncatedWith { get; set; } // Oneof: tree-sitter, indentation - [JsonProperty(PropertyName = "nodeTypes")] - public NodeTypesParams NodeTypes { get; set; } - [JsonProperty(PropertyName = "nodeTypesWithCompletion")] - public NodeTypesWithCompletionParams NodeTypesWithCompletion { get; set; } - [JsonProperty(PropertyName = "lineCount")] - public int LineCount { get; set; } - [JsonProperty(PropertyName = "charCount")] - public int CharCount { get; set; } - [JsonProperty(PropertyName = "insertText")] - public string InsertText { get; set; } - [JsonProperty(PropertyName = "stopReason")] - public string StopReason { get; set; } - } -} diff --git a/agent/bindings/csharp/CompletionItemParams.cs b/agent/bindings/csharp/CompletionItemParams.cs deleted file mode 100644 index 97cbd337cddc..000000000000 --- a/agent/bindings/csharp/CompletionItemParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CompletionItemParams - { - [JsonProperty(PropertyName = "completionID")] - public string CompletionID { get; set; } - } -} diff --git a/agent/bindings/csharp/CompletionLogID.cs b/agent/bindings/csharp/CompletionLogID.cs deleted file mode 100644 index c24bf439eea1..000000000000 --- a/agent/bindings/csharp/CompletionLogID.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CompletionLogID - { - public string Value { get; set; } - - public static implicit operator string(CompletionLogID value) => value.Value; - public static implicit operator CompletionLogID(string value) => new CompletionLogID { Value = value }; - } -} diff --git a/agent/bindings/csharp/Constants.cs b/agent/bindings/csharp/Constants.cs deleted file mode 100644 index a147979ef255..000000000000 --- a/agent/bindings/csharp/Constants.cs +++ /dev/null @@ -1,94 +0,0 @@ -namespace Cody.Core.Agent.Protocol; -{ -public static class Constants -{ - public const string Applied = "Applied"; - public const string Applying = "Applying"; - public const string Automatic = "Automatic"; - public const string Error = "Error"; - public const string Finished = "Finished"; - public const string IDEEXTENSION = "IDEEXTENSION"; - public const string Idle = "Idle"; - public const string Inserting = "Inserting"; - public const string Invoke = "Invoke"; - public const string Pending = "Pending"; - public const string Working = "Working"; - public const string Agentic = "agentic"; - public const string Ask = "ask"; - public const string Assistant = "assistant"; - public const string Autocomplete = "autocomplete"; - public const string Balanced = "balanced"; - public const string Byok = "byok"; - public const string Chat = "chat"; - public const string Class = "class"; - public const string Client-managed = "client-managed"; - public const string Complete = "complete"; - public const string Create-file = "create-file"; - public const string Default = "default"; - public const string Delete = "delete"; - public const string Delete-file = "delete-file"; - public const string Deprecated = "deprecated"; - public const string Dev = "dev"; - public const string Edit = "edit"; - public const string Edit-file = "edit-file"; - public const string Editor = "editor"; - public const string Embeddings = "embeddings"; - public const string Enabled = "enabled"; - public const string Enterprise = "enterprise"; - public const string Error = "error"; - public const string Errored = "errored"; - public const string Experimental = "experimental"; - public const string Fetching = "fetching"; - public const string File = "file"; - public const string Free = "free"; - public const string Function = "function"; - public const string Gateway = "gateway"; - public const string History = "history"; - public const string Human = "human"; - public const string Ignore = "ignore"; - public const string Indentation = "indentation"; - public const string Info = "info"; - public const string Information = "information"; - public const string Initial = "initial"; - public const string Insert = "insert"; - public const string IsChatErrorGuard = "isChatErrorGuard"; - public const string Local = "local"; - public const string Method = "method"; - public const string Multiple = "multiple"; - public const string Native = "native"; - public const string None = "none"; - public const string Notification = "notification"; - public const string Object-encoded = "object-encoded"; - public const string Ollama = "ollama"; - public const string Openctx = "openctx"; - public const string Paused = "paused"; - public const string Power = "power"; - public const string Pro = "pro"; - public const string Recently used = "recently used"; - public const string Recommended = "recommended"; - public const string Rename-file = "rename-file"; - public const string Replace = "replace"; - public const string Repository = "repository"; - public const string Request = "request"; - public const string Search = "search"; - public const string Selection = "selection"; - public const string Server-managed = "server-managed"; - public const string Single = "single"; - public const string Speed = "speed"; - public const string Stateless = "stateless"; - public const string Streaming = "streaming"; - public const string String-encoded = "string-encoded"; - public const string Suggestion = "suggestion"; - public const string Symbol = "symbol"; - public const string System = "system"; - public const string Terminal = "terminal"; - public const string Tree = "tree"; - public const string Tree-sitter = "tree-sitter"; - public const string Unified = "unified"; - public const string Uri = "uri"; - public const string Use = "use"; - public const string User = "user"; - public const string Warning = "warning"; - public const string Workspace = "workspace"; -} -} diff --git a/agent/bindings/csharp/ContextFilters.cs b/agent/bindings/csharp/ContextFilters.cs deleted file mode 100644 index b87b895c1d7a..000000000000 --- a/agent/bindings/csharp/ContextFilters.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ContextFilters - { - [JsonProperty(PropertyName = "include")] - public CodyContextFilterItem[] Include { get; set; } - [JsonProperty(PropertyName = "exclude")] - public CodyContextFilterItem[] Exclude { get; set; } - } -} diff --git a/agent/bindings/csharp/ContextItem.cs b/agent/bindings/csharp/ContextItem.cs deleted file mode 100644 index aee8746c3a35..000000000000 --- a/agent/bindings/csharp/ContextItem.cs +++ /dev/null @@ -1,265 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - - [JsonConverter(typeof(ContextItemConverter))] - public abstract class ContextItem - { - private class ContextItemConverter : JsonConverter - { - public override ContextItem Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var jsonDoc = JsonDocument.ParseValue(ref reader); - var discriminator = jsonDoc.RootElement.GetProperty("type").GetString(); - switch (discriminator) - { - case "file": - return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); - case "repository": - return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); - case "tree": - return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); - case "symbol": - return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); - case "openctx": - return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); - default: - throw new JsonException($"Unknown discriminator {discriminator}"); - } - } - public override void Write(Utf8JsonWriter writer, ${name} value, JsonSerializerOptions options) - { - JsonSerializer.Serialize(writer, value, value.GetType(), options); - } - } - - public class ContextItemFile : ContextItem - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "range")] - public RangeData Range { get; set; } - [JsonProperty(PropertyName = "content")] - public string Content { get; set; } - [JsonProperty(PropertyName = "repoName")] - public string RepoName { get; set; } - [JsonProperty(PropertyName = "revision")] - public string Revision { get; set; } - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - [JsonProperty(PropertyName = "source")] - public ContextItemSource Source { get; set; } // Oneof: embeddings, user, editor, search, initial, unified, selection, terminal, uri, history - [JsonProperty(PropertyName = "size")] - public int Size { get; set; } - [JsonProperty(PropertyName = "isIgnored")] - public bool IsIgnored { get; set; } - [JsonProperty(PropertyName = "isTooLarge")] - public bool IsTooLarge { get; set; } - [JsonProperty(PropertyName = "isTooLargeReason")] - public string IsTooLargeReason { get; set; } - [JsonProperty(PropertyName = "provider")] - public string Provider { get; set; } - [JsonProperty(PropertyName = "icon")] - public string Icon { get; set; } - [JsonProperty(PropertyName = "metadata")] - public string[] Metadata { get; set; } - [JsonProperty(PropertyName = "type")] - public TypeEnum Type { get; set; } // Oneof: file - [JsonProperty(PropertyName = "remoteRepositoryName")] - public string RemoteRepositoryName { get; set; } - - public enum TypeEnum - { - [EnumMember(Value = "file")] - File, - } - } - - public class ContextItemRepository : ContextItem - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "range")] - public RangeData Range { get; set; } - [JsonProperty(PropertyName = "content")] - public string Content { get; set; } - [JsonProperty(PropertyName = "repoName")] - public string RepoName { get; set; } - [JsonProperty(PropertyName = "revision")] - public string Revision { get; set; } - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - [JsonProperty(PropertyName = "source")] - public ContextItemSource Source { get; set; } // Oneof: embeddings, user, editor, search, initial, unified, selection, terminal, uri, history - [JsonProperty(PropertyName = "size")] - public int Size { get; set; } - [JsonProperty(PropertyName = "isIgnored")] - public bool IsIgnored { get; set; } - [JsonProperty(PropertyName = "isTooLarge")] - public bool IsTooLarge { get; set; } - [JsonProperty(PropertyName = "isTooLargeReason")] - public string IsTooLargeReason { get; set; } - [JsonProperty(PropertyName = "provider")] - public string Provider { get; set; } - [JsonProperty(PropertyName = "icon")] - public string Icon { get; set; } - [JsonProperty(PropertyName = "metadata")] - public string[] Metadata { get; set; } - [JsonProperty(PropertyName = "type")] - public TypeEnum Type { get; set; } // Oneof: repository - [JsonProperty(PropertyName = "repoID")] - public string RepoID { get; set; } - - public enum TypeEnum - { - [EnumMember(Value = "repository")] - Repository, - } - } - - public class ContextItemTree : ContextItem - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "range")] - public RangeData Range { get; set; } - [JsonProperty(PropertyName = "content")] - public string Content { get; set; } - [JsonProperty(PropertyName = "repoName")] - public string RepoName { get; set; } - [JsonProperty(PropertyName = "revision")] - public string Revision { get; set; } - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - [JsonProperty(PropertyName = "source")] - public ContextItemSource Source { get; set; } // Oneof: embeddings, user, editor, search, initial, unified, selection, terminal, uri, history - [JsonProperty(PropertyName = "size")] - public int Size { get; set; } - [JsonProperty(PropertyName = "isIgnored")] - public bool IsIgnored { get; set; } - [JsonProperty(PropertyName = "isTooLarge")] - public bool IsTooLarge { get; set; } - [JsonProperty(PropertyName = "isTooLargeReason")] - public string IsTooLargeReason { get; set; } - [JsonProperty(PropertyName = "provider")] - public string Provider { get; set; } - [JsonProperty(PropertyName = "icon")] - public string Icon { get; set; } - [JsonProperty(PropertyName = "metadata")] - public string[] Metadata { get; set; } - [JsonProperty(PropertyName = "type")] - public TypeEnum Type { get; set; } // Oneof: tree - [JsonProperty(PropertyName = "isWorkspaceRoot")] - public bool IsWorkspaceRoot { get; set; } - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - public enum TypeEnum - { - [EnumMember(Value = "tree")] - Tree, - } - } - - public class ContextItemSymbol : ContextItem - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "range")] - public RangeData Range { get; set; } - [JsonProperty(PropertyName = "content")] - public string Content { get; set; } - [JsonProperty(PropertyName = "repoName")] - public string RepoName { get; set; } - [JsonProperty(PropertyName = "revision")] - public string Revision { get; set; } - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - [JsonProperty(PropertyName = "source")] - public ContextItemSource Source { get; set; } // Oneof: embeddings, user, editor, search, initial, unified, selection, terminal, uri, history - [JsonProperty(PropertyName = "size")] - public int Size { get; set; } - [JsonProperty(PropertyName = "isIgnored")] - public bool IsIgnored { get; set; } - [JsonProperty(PropertyName = "isTooLarge")] - public bool IsTooLarge { get; set; } - [JsonProperty(PropertyName = "isTooLargeReason")] - public string IsTooLargeReason { get; set; } - [JsonProperty(PropertyName = "provider")] - public string Provider { get; set; } - [JsonProperty(PropertyName = "icon")] - public string Icon { get; set; } - [JsonProperty(PropertyName = "metadata")] - public string[] Metadata { get; set; } - [JsonProperty(PropertyName = "type")] - public TypeEnum Type { get; set; } // Oneof: symbol - [JsonProperty(PropertyName = "symbolName")] - public string SymbolName { get; set; } - [JsonProperty(PropertyName = "kind")] - public SymbolKind Kind { get; set; } // Oneof: class, function, method - [JsonProperty(PropertyName = "remoteRepositoryName")] - public string RemoteRepositoryName { get; set; } - - public enum TypeEnum - { - [EnumMember(Value = "symbol")] - Symbol, - } - } - - public class ContextItemOpenCtx : ContextItem - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "range")] - public RangeData Range { get; set; } - [JsonProperty(PropertyName = "content")] - public string Content { get; set; } - [JsonProperty(PropertyName = "repoName")] - public string RepoName { get; set; } - [JsonProperty(PropertyName = "revision")] - public string Revision { get; set; } - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - [JsonProperty(PropertyName = "source")] - public ContextItemSource Source { get; set; } // Oneof: embeddings, user, editor, search, initial, unified, selection, terminal, uri, history - [JsonProperty(PropertyName = "size")] - public int Size { get; set; } - [JsonProperty(PropertyName = "isIgnored")] - public bool IsIgnored { get; set; } - [JsonProperty(PropertyName = "isTooLarge")] - public bool IsTooLarge { get; set; } - [JsonProperty(PropertyName = "isTooLargeReason")] - public string IsTooLargeReason { get; set; } - [JsonProperty(PropertyName = "provider")] - public string Provider { get; set; } - [JsonProperty(PropertyName = "icon")] - public string Icon { get; set; } - [JsonProperty(PropertyName = "metadata")] - public string[] Metadata { get; set; } - [JsonProperty(PropertyName = "type")] - public TypeEnum Type { get; set; } // Oneof: openctx - [JsonProperty(PropertyName = "providerUri")] - public string ProviderUri { get; set; } - [JsonProperty(PropertyName = "mention")] - public MentionParams Mention { get; set; } - - public enum TypeEnum - { - [EnumMember(Value = "openctx")] - Openctx, - } - } - } -} diff --git a/agent/bindings/csharp/ContextItemSource.cs b/agent/bindings/csharp/ContextItemSource.cs deleted file mode 100644 index 09cac57e6117..000000000000 --- a/agent/bindings/csharp/ContextItemSource.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - - public enum ContextItemSource - { - [EnumMember(Value = "embeddings")] - Embeddings, - [EnumMember(Value = "user")] - User, - [EnumMember(Value = "editor")] - Editor, - [EnumMember(Value = "search")] - Search, - [EnumMember(Value = "initial")] - Initial, - [EnumMember(Value = "unified")] - Unified, - [EnumMember(Value = "selection")] - Selection, - [EnumMember(Value = "terminal")] - Terminal, - [EnumMember(Value = "uri")] - Uri, - [EnumMember(Value = "history")] - History, - } -} diff --git a/agent/bindings/csharp/ContextParams.cs b/agent/bindings/csharp/ContextParams.cs deleted file mode 100644 index e7e2b6e8394a..000000000000 --- a/agent/bindings/csharp/ContextParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ContextParams - { - [JsonProperty(PropertyName = "user")] - public int User { get; set; } - } -} diff --git a/agent/bindings/csharp/CreateFilesParams.cs b/agent/bindings/csharp/CreateFilesParams.cs deleted file mode 100644 index d6813ec9af36..000000000000 --- a/agent/bindings/csharp/CreateFilesParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CreateFilesParams - { - [JsonProperty(PropertyName = "files")] - public FileIdentifier[] Files { get; set; } - } -} diff --git a/agent/bindings/csharp/CurrentUserCodySubscription.cs b/agent/bindings/csharp/CurrentUserCodySubscription.cs deleted file mode 100644 index 70da363c0b77..000000000000 --- a/agent/bindings/csharp/CurrentUserCodySubscription.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class CurrentUserCodySubscription - { - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - [JsonProperty(PropertyName = "plan")] - public string Plan { get; set; } - [JsonProperty(PropertyName = "applyProRateLimits")] - public bool ApplyProRateLimits { get; set; } - [JsonProperty(PropertyName = "currentPeriodStartAt")] - public Date CurrentPeriodStartAt { get; set; } - [JsonProperty(PropertyName = "currentPeriodEndAt")] - public Date CurrentPeriodEndAt { get; set; } - } -} diff --git a/agent/bindings/csharp/CustomCommandResult.cs b/agent/bindings/csharp/CustomCommandResult.cs deleted file mode 100644 index 5942d919e50e..000000000000 --- a/agent/bindings/csharp/CustomCommandResult.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - - [JsonConverter(typeof(CustomCommandResultConverter))] - public abstract class CustomCommandResult - { - private class CustomCommandResultConverter : JsonConverter - { - public override CustomCommandResult Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var jsonDoc = JsonDocument.ParseValue(ref reader); - var discriminator = jsonDoc.RootElement.GetProperty("type").GetString(); - switch (discriminator) - { - case "chat": - return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); - case "edit": - return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); - default: - throw new JsonException($"Unknown discriminator {discriminator}"); - } - } - public override void Write(Utf8JsonWriter writer, ${name} value, JsonSerializerOptions options) - { - JsonSerializer.Serialize(writer, value, value.GetType(), options); - } - } - - public class CustomChatCommandResult : CustomCommandResult - { - [JsonProperty(PropertyName = "type")] - public TypeEnum Type { get; set; } // Oneof: chat - [JsonProperty(PropertyName = "chatResult")] - public string ChatResult { get; set; } - - public enum TypeEnum - { - [EnumMember(Value = "chat")] - Chat, - } - } - - public class CustomEditCommandResult : CustomCommandResult - { - [JsonProperty(PropertyName = "type")] - public TypeEnum Type { get; set; } // Oneof: edit - [JsonProperty(PropertyName = "editResult")] - public EditTask EditResult { get; set; } - - public enum TypeEnum - { - [EnumMember(Value = "edit")] - Edit, - } - } - } -} diff --git a/agent/bindings/csharp/Date.cs b/agent/bindings/csharp/Date.cs deleted file mode 100644 index 45df115e2d37..000000000000 --- a/agent/bindings/csharp/Date.cs +++ /dev/null @@ -1,6 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class Date : String { } -} diff --git a/agent/bindings/csharp/DebugMessage.cs b/agent/bindings/csharp/DebugMessage.cs deleted file mode 100644 index 512596d4b60e..000000000000 --- a/agent/bindings/csharp/DebugMessage.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class DebugMessage - { - [JsonProperty(PropertyName = "channel")] - public string Channel { get; set; } - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - } -} diff --git a/agent/bindings/csharp/DefiniteWebviewOptions.cs b/agent/bindings/csharp/DefiniteWebviewOptions.cs deleted file mode 100644 index 397a2874b95a..000000000000 --- a/agent/bindings/csharp/DefiniteWebviewOptions.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class DefiniteWebviewOptions - { - [JsonProperty(PropertyName = "enableScripts")] - public bool EnableScripts { get; set; } - [JsonProperty(PropertyName = "enableForms")] - public bool EnableForms { get; set; } - [JsonProperty(PropertyName = "enableOnlyCommandUris")] - public string[] EnableOnlyCommandUris { get; set; } - [JsonProperty(PropertyName = "localResourceRoots")] - public string[] LocalResourceRoots { get; set; } - [JsonProperty(PropertyName = "portMapping")] - public PortMappingParams[] PortMapping { get; set; } - [JsonProperty(PropertyName = "enableFindWidget")] - public bool EnableFindWidget { get; set; } - [JsonProperty(PropertyName = "retainContextWhenHidden")] - public bool RetainContextWhenHidden { get; set; } - } -} diff --git a/agent/bindings/csharp/DeleteFilesParams.cs b/agent/bindings/csharp/DeleteFilesParams.cs deleted file mode 100644 index dac7889cd5d6..000000000000 --- a/agent/bindings/csharp/DeleteFilesParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class DeleteFilesParams - { - [JsonProperty(PropertyName = "files")] - public FileIdentifier[] Files { get; set; } - } -} diff --git a/agent/bindings/csharp/DeleteOptionsParams.cs b/agent/bindings/csharp/DeleteOptionsParams.cs deleted file mode 100644 index 50972f74d985..000000000000 --- a/agent/bindings/csharp/DeleteOptionsParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class DeleteOptionsParams - { - [JsonProperty(PropertyName = "recursive")] - public bool Recursive { get; set; } - [JsonProperty(PropertyName = "ignoreIfNotExists")] - public bool IgnoreIfNotExists { get; set; } - } -} diff --git a/agent/bindings/csharp/DiagnosticSeverity.cs b/agent/bindings/csharp/DiagnosticSeverity.cs deleted file mode 100644 index 2c81ecdc778b..000000000000 --- a/agent/bindings/csharp/DiagnosticSeverity.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - - public enum DiagnosticSeverity - { - [EnumMember(Value = "error")] - Error, - [EnumMember(Value = "warning")] - Warning, - [EnumMember(Value = "info")] - Info, - [EnumMember(Value = "suggestion")] - Suggestion, - } -} diff --git a/agent/bindings/csharp/DiagnosticsPublishParams.cs b/agent/bindings/csharp/DiagnosticsPublishParams.cs deleted file mode 100644 index 76d5bba7a5fd..000000000000 --- a/agent/bindings/csharp/DiagnosticsPublishParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class DiagnosticsPublishParams - { - [JsonProperty(PropertyName = "diagnostics")] - public ProtocolDiagnostic[] Diagnostics { get; set; } - } -} diff --git a/agent/bindings/csharp/DisabledParams.cs b/agent/bindings/csharp/DisabledParams.cs deleted file mode 100644 index b69794e63a41..000000000000 --- a/agent/bindings/csharp/DisabledParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class DisabledParams - { - [JsonProperty(PropertyName = "reason")] - public string Reason { get; set; } - } -} diff --git a/agent/bindings/csharp/DisplayCodeLensParams.cs b/agent/bindings/csharp/DisplayCodeLensParams.cs deleted file mode 100644 index 2dd2ead6fb12..000000000000 --- a/agent/bindings/csharp/DisplayCodeLensParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class DisplayCodeLensParams - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "codeLenses")] - public ProtocolCodeLens[] CodeLenses { get; set; } - } -} diff --git a/agent/bindings/csharp/EditCommandsCodeParams.cs b/agent/bindings/csharp/EditCommandsCodeParams.cs deleted file mode 100644 index a4c749b92a91..000000000000 --- a/agent/bindings/csharp/EditCommandsCodeParams.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class EditCommandsCodeParams - { - [JsonProperty(PropertyName = "instruction")] - public string Instruction { get; set; } - [JsonProperty(PropertyName = "model")] - public string Model { get; set; } - [JsonProperty(PropertyName = "mode")] - public ModeEnum Mode { get; set; } // Oneof: edit, insert - [JsonProperty(PropertyName = "range")] - public Range Range { get; set; } - - public enum ModeEnum - { - [EnumMember(Value = "edit")] - Edit, - [EnumMember(Value = "insert")] - Insert, - } - } -} diff --git a/agent/bindings/csharp/EditTask.cs b/agent/bindings/csharp/EditTask.cs deleted file mode 100644 index d9f3286cbfb1..000000000000 --- a/agent/bindings/csharp/EditTask.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class EditTask - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - [JsonProperty(PropertyName = "state")] - public CodyTaskState State { get; set; } // Oneof: Idle, Working, Inserting, Applying, Applied, Finished, Error, Pending - [JsonProperty(PropertyName = "error")] - public CodyError Error { get; set; } - [JsonProperty(PropertyName = "selectionRange")] - public Range SelectionRange { get; set; } - [JsonProperty(PropertyName = "instruction")] - public string Instruction { get; set; } - [JsonProperty(PropertyName = "model")] - public string Model { get; set; } - [JsonProperty(PropertyName = "originalText")] - public string OriginalText { get; set; } - } -} diff --git a/agent/bindings/csharp/EditTaskAcceptParams.cs b/agent/bindings/csharp/EditTaskAcceptParams.cs deleted file mode 100644 index fc91303fb6f2..000000000000 --- a/agent/bindings/csharp/EditTaskAcceptParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class EditTaskAcceptParams - { - [JsonProperty(PropertyName = "id")] - public FixupTaskID Id { get; set; } - } -} diff --git a/agent/bindings/csharp/EditTaskCancelParams.cs b/agent/bindings/csharp/EditTaskCancelParams.cs deleted file mode 100644 index d0cfd47f49e6..000000000000 --- a/agent/bindings/csharp/EditTaskCancelParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class EditTaskCancelParams - { - [JsonProperty(PropertyName = "id")] - public FixupTaskID Id { get; set; } - } -} diff --git a/agent/bindings/csharp/EditTaskGetTaskDetailsParams.cs b/agent/bindings/csharp/EditTaskGetTaskDetailsParams.cs deleted file mode 100644 index 4471474bd550..000000000000 --- a/agent/bindings/csharp/EditTaskGetTaskDetailsParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class EditTaskGetTaskDetailsParams - { - [JsonProperty(PropertyName = "id")] - public FixupTaskID Id { get; set; } - } -} diff --git a/agent/bindings/csharp/EditTaskRetryParams.cs b/agent/bindings/csharp/EditTaskRetryParams.cs deleted file mode 100644 index 34696551e2a6..000000000000 --- a/agent/bindings/csharp/EditTaskRetryParams.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class EditTaskRetryParams - { - [JsonProperty(PropertyName = "id")] - public FixupTaskID Id { get; set; } - [JsonProperty(PropertyName = "instruction")] - public string Instruction { get; set; } - [JsonProperty(PropertyName = "model")] - public string Model { get; set; } - [JsonProperty(PropertyName = "mode")] - public ModeEnum Mode { get; set; } // Oneof: edit, insert - [JsonProperty(PropertyName = "range")] - public Range Range { get; set; } - - public enum ModeEnum - { - [EnumMember(Value = "edit")] - Edit, - [EnumMember(Value = "insert")] - Insert, - } - } -} diff --git a/agent/bindings/csharp/EditTaskUndoParams.cs b/agent/bindings/csharp/EditTaskUndoParams.cs deleted file mode 100644 index b8eeca201111..000000000000 --- a/agent/bindings/csharp/EditTaskUndoParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class EditTaskUndoParams - { - [JsonProperty(PropertyName = "id")] - public FixupTaskID Id { get; set; } - } -} diff --git a/agent/bindings/csharp/EndParams.cs b/agent/bindings/csharp/EndParams.cs deleted file mode 100644 index a1e7d2a40a4c..000000000000 --- a/agent/bindings/csharp/EndParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class EndParams - { - [JsonProperty(PropertyName = "line")] - public int Line { get; set; } - [JsonProperty(PropertyName = "character")] - public int Character { get; set; } - } -} diff --git a/agent/bindings/csharp/EnhancedContextParams.cs b/agent/bindings/csharp/EnhancedContextParams.cs deleted file mode 100644 index 49eee1477731..000000000000 --- a/agent/bindings/csharp/EnhancedContextParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class EnhancedContextParams - { - [JsonProperty(PropertyName = "selectedRepos")] - public SelectedReposParams[] SelectedRepos { get; set; } - } -} diff --git a/agent/bindings/csharp/EnvOpenExternalParams.cs b/agent/bindings/csharp/EnvOpenExternalParams.cs deleted file mode 100644 index e8beec0b3978..000000000000 --- a/agent/bindings/csharp/EnvOpenExternalParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class EnvOpenExternalParams - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - } -} diff --git a/agent/bindings/csharp/Event.cs b/agent/bindings/csharp/Event.cs deleted file mode 100644 index 17d67e7c12a3..000000000000 --- a/agent/bindings/csharp/Event.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class Event - { - [JsonProperty(PropertyName = "event")] - public string Event { get; set; } - [JsonProperty(PropertyName = "userCookieID")] - public string UserCookieID { get; set; } - [JsonProperty(PropertyName = "url")] - public string Url { get; set; } - [JsonProperty(PropertyName = "source")] - public string Source { get; set; } - [JsonProperty(PropertyName = "argument")] - public string Argument { get; set; } - [JsonProperty(PropertyName = "publicArgument")] - public string PublicArgument { get; set; } - [JsonProperty(PropertyName = "client")] - public string Client { get; set; } - [JsonProperty(PropertyName = "connectedSiteID")] - public string ConnectedSiteID { get; set; } - [JsonProperty(PropertyName = "hashedLicenseKey")] - public string HashedLicenseKey { get; set; } - } -} diff --git a/agent/bindings/csharp/EventProperties.cs b/agent/bindings/csharp/EventProperties.cs deleted file mode 100644 index 857c52c6b5f8..000000000000 --- a/agent/bindings/csharp/EventProperties.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class EventProperties - { - [JsonProperty(PropertyName = "anonymousUserID")] - public string AnonymousUserID { get; set; } - [JsonProperty(PropertyName = "prefix")] - public string Prefix { get; set; } - [JsonProperty(PropertyName = "client")] - public string Client { get; set; } - [JsonProperty(PropertyName = "source")] - public SourceEnum Source { get; set; } // Oneof: IDEEXTENSION - - public enum SourceEnum - { - [EnumMember(Value = "IDEEXTENSION")] - IDEEXTENSION, - } - } -} diff --git a/agent/bindings/csharp/ExecuteCommandParams.cs b/agent/bindings/csharp/ExecuteCommandParams.cs deleted file mode 100644 index 672075c25fb2..000000000000 --- a/agent/bindings/csharp/ExecuteCommandParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ExecuteCommandParams - { - [JsonProperty(PropertyName = "command")] - public string Command { get; set; } - [JsonProperty(PropertyName = "arguments")] - public Object[] Arguments { get; set; } - } -} diff --git a/agent/bindings/csharp/ExtensionConfiguration.cs b/agent/bindings/csharp/ExtensionConfiguration.cs deleted file mode 100644 index 2b5c8ccb69dc..000000000000 --- a/agent/bindings/csharp/ExtensionConfiguration.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ExtensionConfiguration - { - [JsonProperty(PropertyName = "serverEndpoint")] - public string ServerEndpoint { get; set; } - [JsonProperty(PropertyName = "proxy")] - public string Proxy { get; set; } - [JsonProperty(PropertyName = "accessToken")] - public string AccessToken { get; set; } - [JsonProperty(PropertyName = "customHeaders")] - public Dictionary CustomHeaders { get; set; } - [JsonProperty(PropertyName = "anonymousUserID")] - public string AnonymousUserID { get; set; } - [JsonProperty(PropertyName = "autocompleteAdvancedProvider")] - public string AutocompleteAdvancedProvider { get; set; } - [JsonProperty(PropertyName = "autocompleteAdvancedModel")] - public string AutocompleteAdvancedModel { get; set; } - [JsonProperty(PropertyName = "debug")] - public bool Debug { get; set; } - [JsonProperty(PropertyName = "verboseDebug")] - public bool VerboseDebug { get; set; } - [JsonProperty(PropertyName = "telemetryClientName")] - public string TelemetryClientName { get; set; } - [JsonProperty(PropertyName = "codebase")] - public string Codebase { get; set; } - [JsonProperty(PropertyName = "eventProperties")] - public EventProperties EventProperties { get; set; } - [JsonProperty(PropertyName = "customConfiguration")] - public Dictionary CustomConfiguration { get; set; } - [JsonProperty(PropertyName = "baseGlobalState")] - public Dictionary BaseGlobalState { get; set; } - } -} diff --git a/agent/bindings/csharp/FeatureFlagsGetFeatureFlagParams.cs b/agent/bindings/csharp/FeatureFlagsGetFeatureFlagParams.cs deleted file mode 100644 index 1f086f11eb42..000000000000 --- a/agent/bindings/csharp/FeatureFlagsGetFeatureFlagParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class FeatureFlagsGetFeatureFlagParams - { - [JsonProperty(PropertyName = "flagName")] - public string FlagName { get; set; } - } -} diff --git a/agent/bindings/csharp/FileIdentifier.cs b/agent/bindings/csharp/FileIdentifier.cs deleted file mode 100644 index 3b042feb2914..000000000000 --- a/agent/bindings/csharp/FileIdentifier.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class FileIdentifier - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - } -} diff --git a/agent/bindings/csharp/FixupTaskID.cs b/agent/bindings/csharp/FixupTaskID.cs deleted file mode 100644 index b869c75f7cf2..000000000000 --- a/agent/bindings/csharp/FixupTaskID.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class FixupTaskID - { - public string Value { get; set; } - - public static implicit operator string(FixupTaskID value) => value.Value; - public static implicit operator FixupTaskID(string value) => new FixupTaskID { Value = value }; - } -} diff --git a/agent/bindings/csharp/GetDocumentsParams.cs b/agent/bindings/csharp/GetDocumentsParams.cs deleted file mode 100644 index 403cdbb42c92..000000000000 --- a/agent/bindings/csharp/GetDocumentsParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class GetDocumentsParams - { - [JsonProperty(PropertyName = "uris")] - public string[] Uris { get; set; } - } -} diff --git a/agent/bindings/csharp/GetDocumentsResult.cs b/agent/bindings/csharp/GetDocumentsResult.cs deleted file mode 100644 index 9e0f500f3a63..000000000000 --- a/agent/bindings/csharp/GetDocumentsResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class GetDocumentsResult - { - [JsonProperty(PropertyName = "documents")] - public ProtocolTextDocument[] Documents { get; set; } - } -} diff --git a/agent/bindings/csharp/GetFoldingRangeParams.cs b/agent/bindings/csharp/GetFoldingRangeParams.cs deleted file mode 100644 index f939616e756a..000000000000 --- a/agent/bindings/csharp/GetFoldingRangeParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class GetFoldingRangeParams - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "range")] - public Range Range { get; set; } - } -} diff --git a/agent/bindings/csharp/GetFoldingRangeResult.cs b/agent/bindings/csharp/GetFoldingRangeResult.cs deleted file mode 100644 index a60bcec50b5e..000000000000 --- a/agent/bindings/csharp/GetFoldingRangeResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class GetFoldingRangeResult - { - [JsonProperty(PropertyName = "range")] - public Range Range { get; set; } - } -} diff --git a/agent/bindings/csharp/GitCodebaseNameParams.cs b/agent/bindings/csharp/GitCodebaseNameParams.cs deleted file mode 100644 index 8861445eaeeb..000000000000 --- a/agent/bindings/csharp/GitCodebaseNameParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class GitCodebaseNameParams - { - [JsonProperty(PropertyName = "url")] - public string Url { get; set; } - } -} diff --git a/agent/bindings/csharp/GraphqlGetRepoIdIfEmbeddingExistsParams.cs b/agent/bindings/csharp/GraphqlGetRepoIdIfEmbeddingExistsParams.cs deleted file mode 100644 index 736e2266953f..000000000000 --- a/agent/bindings/csharp/GraphqlGetRepoIdIfEmbeddingExistsParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class GraphqlGetRepoIdIfEmbeddingExistsParams - { - [JsonProperty(PropertyName = "repoName")] - public string RepoName { get; set; } - } -} diff --git a/agent/bindings/csharp/GraphqlGetRepoIdParams.cs b/agent/bindings/csharp/GraphqlGetRepoIdParams.cs deleted file mode 100644 index de473e21a8f5..000000000000 --- a/agent/bindings/csharp/GraphqlGetRepoIdParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class GraphqlGetRepoIdParams - { - [JsonProperty(PropertyName = "repoName")] - public string RepoName { get; set; } - } -} diff --git a/agent/bindings/csharp/GraphqlGetRepoIdsParams.cs b/agent/bindings/csharp/GraphqlGetRepoIdsParams.cs deleted file mode 100644 index 9cca46b4e0e1..000000000000 --- a/agent/bindings/csharp/GraphqlGetRepoIdsParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class GraphqlGetRepoIdsParams - { - [JsonProperty(PropertyName = "names")] - public string[] Names { get; set; } - [JsonProperty(PropertyName = "first")] - public int First { get; set; } - } -} diff --git a/agent/bindings/csharp/GraphqlGetRepoIdsResult.cs b/agent/bindings/csharp/GraphqlGetRepoIdsResult.cs deleted file mode 100644 index a9db17163e8a..000000000000 --- a/agent/bindings/csharp/GraphqlGetRepoIdsResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class GraphqlGetRepoIdsResult - { - [JsonProperty(PropertyName = "repos")] - public ReposParams[] Repos { get; set; } - } -} diff --git a/agent/bindings/csharp/IconsParams.cs b/agent/bindings/csharp/IconsParams.cs deleted file mode 100644 index 44da1b011955..000000000000 --- a/agent/bindings/csharp/IconsParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class IconsParams - { - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - [JsonProperty(PropertyName = "position")] - public int Position { get; set; } - } -} diff --git a/agent/bindings/csharp/IgnoreTestParams.cs b/agent/bindings/csharp/IgnoreTestParams.cs deleted file mode 100644 index 89a94f7fe5e1..000000000000 --- a/agent/bindings/csharp/IgnoreTestParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class IgnoreTestParams - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - } -} diff --git a/agent/bindings/csharp/IgnoreTestResult.cs b/agent/bindings/csharp/IgnoreTestResult.cs deleted file mode 100644 index c39e080903fe..000000000000 --- a/agent/bindings/csharp/IgnoreTestResult.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class IgnoreTestResult - { - [JsonProperty(PropertyName = "policy")] - public PolicyEnum Policy { get; set; } // Oneof: ignore, use - - public enum PolicyEnum - { - [EnumMember(Value = "ignore")] - Ignore, - [EnumMember(Value = "use")] - Use, - } - } -} diff --git a/agent/bindings/csharp/MemoryUsage.cs b/agent/bindings/csharp/MemoryUsage.cs deleted file mode 100644 index 7f7a44e8e70d..000000000000 --- a/agent/bindings/csharp/MemoryUsage.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class MemoryUsage - { - [JsonProperty(PropertyName = "rss")] - public int Rss { get; set; } - [JsonProperty(PropertyName = "heapTotal")] - public int HeapTotal { get; set; } - [JsonProperty(PropertyName = "heapUsed")] - public int HeapUsed { get; set; } - [JsonProperty(PropertyName = "external")] - public int External { get; set; } - [JsonProperty(PropertyName = "arrayBuffers")] - public int ArrayBuffers { get; set; } - } -} diff --git a/agent/bindings/csharp/MentionParams.cs b/agent/bindings/csharp/MentionParams.cs deleted file mode 100644 index d5cb0cac0da4..000000000000 --- a/agent/bindings/csharp/MentionParams.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class MentionParams - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "data")] - public Object Data { get; set; } - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - } -} diff --git a/agent/bindings/csharp/MessageOptions.cs b/agent/bindings/csharp/MessageOptions.cs deleted file mode 100644 index e916629656ec..000000000000 --- a/agent/bindings/csharp/MessageOptions.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class MessageOptions - { - [JsonProperty(PropertyName = "modal")] - public bool Modal { get; set; } - [JsonProperty(PropertyName = "detail")] - public string Detail { get; set; } - } -} diff --git a/agent/bindings/csharp/Model.cs b/agent/bindings/csharp/Model.cs deleted file mode 100644 index 5beac6c08027..000000000000 --- a/agent/bindings/csharp/Model.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class Model - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - [JsonProperty(PropertyName = "usage")] - public ModelUsage[] Usage { get; set; } - [JsonProperty(PropertyName = "contextWindow")] - public ModelContextWindow ContextWindow { get; set; } - [JsonProperty(PropertyName = "clientSideConfig")] - public ClientSideConfig ClientSideConfig { get; set; } - [JsonProperty(PropertyName = "provider")] - public string Provider { get; set; } - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - [JsonProperty(PropertyName = "tags")] - public ModelTag[] Tags { get; set; } - [JsonProperty(PropertyName = "modelRef")] - public ModelRef ModelRef { get; set; } - } -} diff --git a/agent/bindings/csharp/ModelContextWindow.cs b/agent/bindings/csharp/ModelContextWindow.cs deleted file mode 100644 index 32efcac0dcf8..000000000000 --- a/agent/bindings/csharp/ModelContextWindow.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ModelContextWindow - { - [JsonProperty(PropertyName = "input")] - public int Input { get; set; } - [JsonProperty(PropertyName = "output")] - public int Output { get; set; } - [JsonProperty(PropertyName = "context")] - public ContextParams Context { get; set; } - } -} diff --git a/agent/bindings/csharp/ModelId.cs b/agent/bindings/csharp/ModelId.cs deleted file mode 100644 index cd39fcaf94ae..000000000000 --- a/agent/bindings/csharp/ModelId.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ModelId - { - public string Value { get; set; } - - public static implicit operator string(ModelId value) => value.Value; - public static implicit operator ModelId(string value) => new ModelId { Value = value }; - } -} diff --git a/agent/bindings/csharp/ModelRef.cs b/agent/bindings/csharp/ModelRef.cs deleted file mode 100644 index 053099fd3fde..000000000000 --- a/agent/bindings/csharp/ModelRef.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ModelRef - { - [JsonProperty(PropertyName = "providerId")] - public ProviderId ProviderId { get; set; } - [JsonProperty(PropertyName = "apiVersionId")] - public ApiVersionId ApiVersionId { get; set; } - [JsonProperty(PropertyName = "modelId")] - public ModelId ModelId { get; set; } - } -} diff --git a/agent/bindings/csharp/ModelTag.cs b/agent/bindings/csharp/ModelTag.cs deleted file mode 100644 index 6a15a993938f..000000000000 --- a/agent/bindings/csharp/ModelTag.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - - public enum ModelTag - { - [EnumMember(Value = "power")] - Power, - [EnumMember(Value = "speed")] - Speed, - [EnumMember(Value = "balanced")] - Balanced, - [EnumMember(Value = "recommended")] - Recommended, - [EnumMember(Value = "deprecated")] - Deprecated, - [EnumMember(Value = "experimental")] - Experimental, - [EnumMember(Value = "pro")] - Pro, - [EnumMember(Value = "free")] - Free, - [EnumMember(Value = "enterprise")] - Enterprise, - [EnumMember(Value = "gateway")] - Gateway, - [EnumMember(Value = "byok")] - Byok, - [EnumMember(Value = "local")] - Local, - [EnumMember(Value = "ollama")] - Ollama, - [EnumMember(Value = "dev")] - Dev, - } -} diff --git a/agent/bindings/csharp/ModelUsage.cs b/agent/bindings/csharp/ModelUsage.cs deleted file mode 100644 index 66f764f1f306..000000000000 --- a/agent/bindings/csharp/ModelUsage.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - - public enum ModelUsage - { - [EnumMember(Value = "chat")] - Chat, - [EnumMember(Value = "edit")] - Edit, - [EnumMember(Value = "autocomplete")] - Autocomplete, - } -} diff --git a/agent/bindings/csharp/NetworkRequest.cs b/agent/bindings/csharp/NetworkRequest.cs deleted file mode 100644 index 61cab79fee63..000000000000 --- a/agent/bindings/csharp/NetworkRequest.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class NetworkRequest - { - [JsonProperty(PropertyName = "url")] - public string Url { get; set; } - [JsonProperty(PropertyName = "body")] - public string Body { get; set; } - [JsonProperty(PropertyName = "error")] - public string Error { get; set; } - } -} diff --git a/agent/bindings/csharp/NodeTypesParams.cs b/agent/bindings/csharp/NodeTypesParams.cs deleted file mode 100644 index 4f12195067a3..000000000000 --- a/agent/bindings/csharp/NodeTypesParams.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class NodeTypesParams - { - [JsonProperty(PropertyName = "atCursor")] - public string AtCursor { get; set; } - [JsonProperty(PropertyName = "parent")] - public string Parent { get; set; } - [JsonProperty(PropertyName = "grandparent")] - public string Grandparent { get; set; } - [JsonProperty(PropertyName = "greatGrandparent")] - public string GreatGrandparent { get; set; } - [JsonProperty(PropertyName = "lastAncestorOnTheSameLine")] - public string LastAncestorOnTheSameLine { get; set; } - } -} diff --git a/agent/bindings/csharp/NodeTypesWithCompletionParams.cs b/agent/bindings/csharp/NodeTypesWithCompletionParams.cs deleted file mode 100644 index 135487daade4..000000000000 --- a/agent/bindings/csharp/NodeTypesWithCompletionParams.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class NodeTypesWithCompletionParams - { - [JsonProperty(PropertyName = "atCursor")] - public string AtCursor { get; set; } - [JsonProperty(PropertyName = "parent")] - public string Parent { get; set; } - [JsonProperty(PropertyName = "grandparent")] - public string Grandparent { get; set; } - [JsonProperty(PropertyName = "greatGrandparent")] - public string GreatGrandparent { get; set; } - [JsonProperty(PropertyName = "lastAncestorOnTheSameLine")] - public string LastAncestorOnTheSameLine { get; set; } - } -} diff --git a/agent/bindings/csharp/Null.cs b/agent/bindings/csharp/Null.cs deleted file mode 100644 index 7e6731d9f588..000000000000 --- a/agent/bindings/csharp/Null.cs +++ /dev/null @@ -1,4 +0,0 @@ -namespace Cody.Core.Agent.Protocol; -{ - public sealed class Null {} -} diff --git a/agent/bindings/csharp/OpenAICompatible.cs b/agent/bindings/csharp/OpenAICompatible.cs deleted file mode 100644 index 560d018c4350..000000000000 --- a/agent/bindings/csharp/OpenAICompatible.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class OpenAICompatible - { - [JsonProperty(PropertyName = "stopSequences")] - public string[] StopSequences { get; set; } - [JsonProperty(PropertyName = "endOfText")] - public string EndOfText { get; set; } - [JsonProperty(PropertyName = "contextSizeHintTotalCharacters")] - public int ContextSizeHintTotalCharacters { get; set; } - [JsonProperty(PropertyName = "contextSizeHintPrefixCharacters")] - public int ContextSizeHintPrefixCharacters { get; set; } - [JsonProperty(PropertyName = "contextSizeHintSuffixCharacters")] - public int ContextSizeHintSuffixCharacters { get; set; } - [JsonProperty(PropertyName = "chatPreInstruction")] - public string ChatPreInstruction { get; set; } - [JsonProperty(PropertyName = "editPostInstruction")] - public string EditPostInstruction { get; set; } - [JsonProperty(PropertyName = "autocompleteSinglelineTimeout")] - public int AutocompleteSinglelineTimeout { get; set; } - [JsonProperty(PropertyName = "autocompleteMultilineTimeout")] - public int AutocompleteMultilineTimeout { get; set; } - [JsonProperty(PropertyName = "chatTopK")] - public int ChatTopK { get; set; } - [JsonProperty(PropertyName = "chatTopP")] - public int ChatTopP { get; set; } - [JsonProperty(PropertyName = "chatTemperature")] - public int ChatTemperature { get; set; } - [JsonProperty(PropertyName = "chatMaxTokens")] - public int ChatMaxTokens { get; set; } - [JsonProperty(PropertyName = "autoCompleteTopK")] - public int AutoCompleteTopK { get; set; } - [JsonProperty(PropertyName = "autoCompleteTopP")] - public int AutoCompleteTopP { get; set; } - [JsonProperty(PropertyName = "autoCompleteTemperature")] - public int AutoCompleteTemperature { get; set; } - [JsonProperty(PropertyName = "autoCompleteSinglelineMaxTokens")] - public int AutoCompleteSinglelineMaxTokens { get; set; } - [JsonProperty(PropertyName = "autoCompleteMultilineMaxTokens")] - public int AutoCompleteMultilineMaxTokens { get; set; } - [JsonProperty(PropertyName = "editTopK")] - public int EditTopK { get; set; } - [JsonProperty(PropertyName = "editTopP")] - public int EditTopP { get; set; } - [JsonProperty(PropertyName = "editTemperature")] - public int EditTemperature { get; set; } - [JsonProperty(PropertyName = "editMaxTokens")] - public int EditMaxTokens { get; set; } - } -} diff --git a/agent/bindings/csharp/OptionsParams.cs b/agent/bindings/csharp/OptionsParams.cs deleted file mode 100644 index 7b4d302c95c3..000000000000 --- a/agent/bindings/csharp/OptionsParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class OptionsParams - { - [JsonProperty(PropertyName = "undoStopBefore")] - public bool UndoStopBefore { get; set; } - [JsonProperty(PropertyName = "undoStopAfter")] - public bool UndoStopAfter { get; set; } - } -} diff --git a/agent/bindings/csharp/PortMappingParams.cs b/agent/bindings/csharp/PortMappingParams.cs deleted file mode 100644 index fc8a09312a15..000000000000 --- a/agent/bindings/csharp/PortMappingParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class PortMappingParams - { - [JsonProperty(PropertyName = "webviewPort")] - public int WebviewPort { get; set; } - [JsonProperty(PropertyName = "extensionHostPort")] - public int ExtensionHostPort { get; set; } - } -} diff --git a/agent/bindings/csharp/Position.cs b/agent/bindings/csharp/Position.cs deleted file mode 100644 index 34f9184e8cde..000000000000 --- a/agent/bindings/csharp/Position.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class Position - { - [JsonProperty(PropertyName = "line")] - public int Line { get; set; } - [JsonProperty(PropertyName = "character")] - public int Character { get; set; } - } -} diff --git a/agent/bindings/csharp/ProgressCancelParams.cs b/agent/bindings/csharp/ProgressCancelParams.cs deleted file mode 100644 index 0d55838dfd49..000000000000 --- a/agent/bindings/csharp/ProgressCancelParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ProgressCancelParams - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - } -} diff --git a/agent/bindings/csharp/ProgressEndParams.cs b/agent/bindings/csharp/ProgressEndParams.cs deleted file mode 100644 index 136b6e30d3c2..000000000000 --- a/agent/bindings/csharp/ProgressEndParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ProgressEndParams - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - } -} diff --git a/agent/bindings/csharp/ProgressOptions.cs b/agent/bindings/csharp/ProgressOptions.cs deleted file mode 100644 index b139b9f4db68..000000000000 --- a/agent/bindings/csharp/ProgressOptions.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ProgressOptions - { - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - [JsonProperty(PropertyName = "locationViewId")] - public string LocationViewId { get; set; } - [JsonProperty(PropertyName = "cancellable")] - public bool Cancellable { get; set; } - } -} diff --git a/agent/bindings/csharp/ProgressReportParams.cs b/agent/bindings/csharp/ProgressReportParams.cs deleted file mode 100644 index 418482558fa4..000000000000 --- a/agent/bindings/csharp/ProgressReportParams.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ProgressReportParams - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - [JsonProperty(PropertyName = "increment")] - public int Increment { get; set; } - } -} diff --git a/agent/bindings/csharp/ProgressStartParams.cs b/agent/bindings/csharp/ProgressStartParams.cs deleted file mode 100644 index a8a58b4bd6cd..000000000000 --- a/agent/bindings/csharp/ProgressStartParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ProgressStartParams - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - [JsonProperty(PropertyName = "options")] - public ProgressOptions Options { get; set; } - } -} diff --git a/agent/bindings/csharp/ProtocolCodeAction.cs b/agent/bindings/csharp/ProtocolCodeAction.cs deleted file mode 100644 index 43623081ac8b..000000000000 --- a/agent/bindings/csharp/ProtocolCodeAction.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ProtocolCodeAction - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - [JsonProperty(PropertyName = "commandID")] - public string CommandID { get; set; } - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - [JsonProperty(PropertyName = "diagnostics")] - public ProtocolDiagnostic[] Diagnostics { get; set; } - [JsonProperty(PropertyName = "kind")] - public string Kind { get; set; } - [JsonProperty(PropertyName = "isPreferred")] - public bool IsPreferred { get; set; } - [JsonProperty(PropertyName = "disabled")] - public DisabledParams Disabled { get; set; } - } -} diff --git a/agent/bindings/csharp/ProtocolCodeLens.cs b/agent/bindings/csharp/ProtocolCodeLens.cs deleted file mode 100644 index 225391ab4157..000000000000 --- a/agent/bindings/csharp/ProtocolCodeLens.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ProtocolCodeLens - { - [JsonProperty(PropertyName = "range")] - public Range Range { get; set; } - [JsonProperty(PropertyName = "command")] - public ProtocolCommand Command { get; set; } - [JsonProperty(PropertyName = "isResolved")] - public bool IsResolved { get; set; } - } -} diff --git a/agent/bindings/csharp/ProtocolCommand.cs b/agent/bindings/csharp/ProtocolCommand.cs deleted file mode 100644 index b8ad1506f854..000000000000 --- a/agent/bindings/csharp/ProtocolCommand.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ProtocolCommand - { - [JsonProperty(PropertyName = "title")] - public TitleParams Title { get; set; } - [JsonProperty(PropertyName = "command")] - public string Command { get; set; } - [JsonProperty(PropertyName = "tooltip")] - public string Tooltip { get; set; } - [JsonProperty(PropertyName = "arguments")] - public Object[] Arguments { get; set; } - } -} diff --git a/agent/bindings/csharp/ProtocolDiagnostic.cs b/agent/bindings/csharp/ProtocolDiagnostic.cs deleted file mode 100644 index 74f377633bdd..000000000000 --- a/agent/bindings/csharp/ProtocolDiagnostic.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ProtocolDiagnostic - { - [JsonProperty(PropertyName = "location")] - public ProtocolLocation Location { get; set; } - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - [JsonProperty(PropertyName = "severity")] - public DiagnosticSeverity Severity { get; set; } // Oneof: error, warning, info, suggestion - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } - [JsonProperty(PropertyName = "source")] - public string Source { get; set; } - [JsonProperty(PropertyName = "relatedInformation")] - public ProtocolRelatedInformationDiagnostic[] RelatedInformation { get; set; } - } -} diff --git a/agent/bindings/csharp/ProtocolLocation.cs b/agent/bindings/csharp/ProtocolLocation.cs deleted file mode 100644 index 3312ddb23a5c..000000000000 --- a/agent/bindings/csharp/ProtocolLocation.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ProtocolLocation - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "range")] - public Range Range { get; set; } - } -} diff --git a/agent/bindings/csharp/ProtocolRelatedInformationDiagnostic.cs b/agent/bindings/csharp/ProtocolRelatedInformationDiagnostic.cs deleted file mode 100644 index f23aee9e0fe5..000000000000 --- a/agent/bindings/csharp/ProtocolRelatedInformationDiagnostic.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ProtocolRelatedInformationDiagnostic - { - [JsonProperty(PropertyName = "location")] - public ProtocolLocation Location { get; set; } - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - } -} diff --git a/agent/bindings/csharp/ProtocolTextDocument.cs b/agent/bindings/csharp/ProtocolTextDocument.cs deleted file mode 100644 index b73265361b5c..000000000000 --- a/agent/bindings/csharp/ProtocolTextDocument.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ProtocolTextDocument - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "filePath")] - public string FilePath { get; set; } - [JsonProperty(PropertyName = "content")] - public string Content { get; set; } - [JsonProperty(PropertyName = "selection")] - public Range Selection { get; set; } - [JsonProperty(PropertyName = "contentChanges")] - public ProtocolTextDocumentContentChangeEvent[] ContentChanges { get; set; } - [JsonProperty(PropertyName = "visibleRange")] - public Range VisibleRange { get; set; } - [JsonProperty(PropertyName = "testing")] - public TestingParams Testing { get; set; } - } -} diff --git a/agent/bindings/csharp/ProtocolTextDocumentContentChangeEvent.cs b/agent/bindings/csharp/ProtocolTextDocumentContentChangeEvent.cs deleted file mode 100644 index 8a56a25f425a..000000000000 --- a/agent/bindings/csharp/ProtocolTextDocumentContentChangeEvent.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ProtocolTextDocumentContentChangeEvent - { - [JsonProperty(PropertyName = "range")] - public Range Range { get; set; } - [JsonProperty(PropertyName = "text")] - public string Text { get; set; } - } -} diff --git a/agent/bindings/csharp/ProtocolTypeAdapters.cs b/agent/bindings/csharp/ProtocolTypeAdapters.cs deleted file mode 100644 index eb4ad72b7aa9..000000000000 --- a/agent/bindings/csharp/ProtocolTypeAdapters.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Cody.Core.Agent.Protocol; -{ - public static class ProtocolTypeAdapters - { - public static void Register(JsonSerializerOptions options) - { - options.Converters.Add(new ContextItemConverter()); - options.Converters.Add(new CustomCommandResultConverter()); - options.Converters.Add(new TextEditConverter()); - options.Converters.Add(new WorkspaceEditOperationConverter()); - } -} diff --git a/agent/bindings/csharp/ProviderId.cs b/agent/bindings/csharp/ProviderId.cs deleted file mode 100644 index 4499d5f3d405..000000000000 --- a/agent/bindings/csharp/ProviderId.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ProviderId - { - public string Value { get; set; } - - public static implicit operator string(ProviderId value) => value.Value; - public static implicit operator ProviderId(string value) => new ProviderId { Value = value }; - } -} diff --git a/agent/bindings/csharp/Range.cs b/agent/bindings/csharp/Range.cs deleted file mode 100644 index 50a4e098a5c1..000000000000 --- a/agent/bindings/csharp/Range.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class Range - { - [JsonProperty(PropertyName = "start")] - public Position Start { get; set; } - [JsonProperty(PropertyName = "end")] - public Position End { get; set; } - } -} diff --git a/agent/bindings/csharp/RangeData.cs b/agent/bindings/csharp/RangeData.cs deleted file mode 100644 index 16c18685787d..000000000000 --- a/agent/bindings/csharp/RangeData.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class RangeData - { - [JsonProperty(PropertyName = "start")] - public StartParams Start { get; set; } - [JsonProperty(PropertyName = "end")] - public EndParams End { get; set; } - } -} diff --git a/agent/bindings/csharp/RemoteRepoFetchState.cs b/agent/bindings/csharp/RemoteRepoFetchState.cs deleted file mode 100644 index 574f049a6dc7..000000000000 --- a/agent/bindings/csharp/RemoteRepoFetchState.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class RemoteRepoFetchState - { - [JsonProperty(PropertyName = "state")] - public StateEnum State { get; set; } // Oneof: paused, fetching, errored, complete - [JsonProperty(PropertyName = "error")] - public CodyError Error { get; set; } - - public enum StateEnum - { - [EnumMember(Value = "paused")] - Paused, - [EnumMember(Value = "fetching")] - Fetching, - [EnumMember(Value = "errored")] - Errored, - [EnumMember(Value = "complete")] - Complete, - } - } -} diff --git a/agent/bindings/csharp/RemoteRepoHasParams.cs b/agent/bindings/csharp/RemoteRepoHasParams.cs deleted file mode 100644 index 8ee16f1f2668..000000000000 --- a/agent/bindings/csharp/RemoteRepoHasParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class RemoteRepoHasParams - { - [JsonProperty(PropertyName = "repoName")] - public string RepoName { get; set; } - } -} diff --git a/agent/bindings/csharp/RemoteRepoHasResult.cs b/agent/bindings/csharp/RemoteRepoHasResult.cs deleted file mode 100644 index f56a0b1f83cb..000000000000 --- a/agent/bindings/csharp/RemoteRepoHasResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class RemoteRepoHasResult - { - [JsonProperty(PropertyName = "result")] - public bool Result { get; set; } - } -} diff --git a/agent/bindings/csharp/RemoteRepoListParams.cs b/agent/bindings/csharp/RemoteRepoListParams.cs deleted file mode 100644 index 6b38ccefa20a..000000000000 --- a/agent/bindings/csharp/RemoteRepoListParams.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class RemoteRepoListParams - { - [JsonProperty(PropertyName = "query")] - public string Query { get; set; } - [JsonProperty(PropertyName = "first")] - public int First { get; set; } - [JsonProperty(PropertyName = "afterId")] - public string AfterId { get; set; } - } -} diff --git a/agent/bindings/csharp/RemoteRepoListResult.cs b/agent/bindings/csharp/RemoteRepoListResult.cs deleted file mode 100644 index 712d85610432..000000000000 --- a/agent/bindings/csharp/RemoteRepoListResult.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class RemoteRepoListResult - { - [JsonProperty(PropertyName = "startIndex")] - public int StartIndex { get; set; } - [JsonProperty(PropertyName = "count")] - public int Count { get; set; } - [JsonProperty(PropertyName = "repos")] - public ReposParams[] Repos { get; set; } - [JsonProperty(PropertyName = "state")] - public RemoteRepoFetchState State { get; set; } - } -} diff --git a/agent/bindings/csharp/RenameFile.cs b/agent/bindings/csharp/RenameFile.cs deleted file mode 100644 index 81c9ad9e9304..000000000000 --- a/agent/bindings/csharp/RenameFile.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class RenameFile - { - [JsonProperty(PropertyName = "oldUri")] - public string OldUri { get; set; } - [JsonProperty(PropertyName = "newUri")] - public string NewUri { get; set; } - } -} diff --git a/agent/bindings/csharp/RenameFilesParams.cs b/agent/bindings/csharp/RenameFilesParams.cs deleted file mode 100644 index 2ede65fdbe88..000000000000 --- a/agent/bindings/csharp/RenameFilesParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class RenameFilesParams - { - [JsonProperty(PropertyName = "files")] - public RenameFile[] Files { get; set; } - } -} diff --git a/agent/bindings/csharp/Repo.cs b/agent/bindings/csharp/Repo.cs deleted file mode 100644 index 33fb105a2d79..000000000000 --- a/agent/bindings/csharp/Repo.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class Repo - { - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - } -} diff --git a/agent/bindings/csharp/ReposParams.cs b/agent/bindings/csharp/ReposParams.cs deleted file mode 100644 index e7c36610fba8..000000000000 --- a/agent/bindings/csharp/ReposParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ReposParams - { - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - } -} diff --git a/agent/bindings/csharp/SaveDialogOptionsParams.cs b/agent/bindings/csharp/SaveDialogOptionsParams.cs deleted file mode 100644 index dabce13b6b5e..000000000000 --- a/agent/bindings/csharp/SaveDialogOptionsParams.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class SaveDialogOptionsParams - { - [JsonProperty(PropertyName = "defaultUri")] - public string DefaultUri { get; set; } - [JsonProperty(PropertyName = "saveLabel")] - public string SaveLabel { get; set; } - [JsonProperty(PropertyName = "filters")] - public Dictionary Filters { get; set; } - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - } -} diff --git a/agent/bindings/csharp/SelectedCompletionInfo.cs b/agent/bindings/csharp/SelectedCompletionInfo.cs deleted file mode 100644 index beb8fe487b16..000000000000 --- a/agent/bindings/csharp/SelectedCompletionInfo.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class SelectedCompletionInfo - { - [JsonProperty(PropertyName = "range")] - public Range Range { get; set; } - [JsonProperty(PropertyName = "text")] - public string Text { get; set; } - } -} diff --git a/agent/bindings/csharp/SelectedReposParams.cs b/agent/bindings/csharp/SelectedReposParams.cs deleted file mode 100644 index 8724e3b65c1c..000000000000 --- a/agent/bindings/csharp/SelectedReposParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class SelectedReposParams - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - } -} diff --git a/agent/bindings/csharp/SerializedChatInteraction.cs b/agent/bindings/csharp/SerializedChatInteraction.cs deleted file mode 100644 index 4a81e367af89..000000000000 --- a/agent/bindings/csharp/SerializedChatInteraction.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class SerializedChatInteraction - { - [JsonProperty(PropertyName = "humanMessage")] - public SerializedChatMessage HumanMessage { get; set; } - [JsonProperty(PropertyName = "assistantMessage")] - public SerializedChatMessage AssistantMessage { get; set; } - } -} diff --git a/agent/bindings/csharp/SerializedChatMessage.cs b/agent/bindings/csharp/SerializedChatMessage.cs deleted file mode 100644 index 2cf7cbe32761..000000000000 --- a/agent/bindings/csharp/SerializedChatMessage.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class SerializedChatMessage - { - [JsonProperty(PropertyName = "contextFiles")] - public ContextItem[] ContextFiles { get; set; } - [JsonProperty(PropertyName = "error")] - public ChatError Error { get; set; } - [JsonProperty(PropertyName = "editorState")] - public Object EditorState { get; set; } - [JsonProperty(PropertyName = "speaker")] - public SpeakerEnum Speaker { get; set; } // Oneof: human, assistant, system - [JsonProperty(PropertyName = "text")] - public string Text { get; set; } - [JsonProperty(PropertyName = "model")] - public string Model { get; set; } - - public enum SpeakerEnum - { - [EnumMember(Value = "human")] - Human, - [EnumMember(Value = "assistant")] - Assistant, - [EnumMember(Value = "system")] - System, - } - } -} diff --git a/agent/bindings/csharp/SerializedChatTranscript.cs b/agent/bindings/csharp/SerializedChatTranscript.cs deleted file mode 100644 index 4fe454289bd3..000000000000 --- a/agent/bindings/csharp/SerializedChatTranscript.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class SerializedChatTranscript - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - [JsonProperty(PropertyName = "chatTitle")] - public string ChatTitle { get; set; } - [JsonProperty(PropertyName = "interactions")] - public SerializedChatInteraction[] Interactions { get; set; } - [JsonProperty(PropertyName = "lastInteractionTimestamp")] - public string LastInteractionTimestamp { get; set; } - [JsonProperty(PropertyName = "enhancedContext")] - public EnhancedContextParams EnhancedContext { get; set; } - } -} diff --git a/agent/bindings/csharp/ServerInfo.cs b/agent/bindings/csharp/ServerInfo.cs deleted file mode 100644 index f77f817660d8..000000000000 --- a/agent/bindings/csharp/ServerInfo.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ServerInfo - { - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - [JsonProperty(PropertyName = "authenticated")] - public bool Authenticated { get; set; } - [JsonProperty(PropertyName = "codyEnabled")] - public bool CodyEnabled { get; set; } - [JsonProperty(PropertyName = "codyVersion")] - public string CodyVersion { get; set; } - [JsonProperty(PropertyName = "authStatus")] - public AuthStatus AuthStatus { get; set; } - } -} diff --git a/agent/bindings/csharp/ShowOptionsParams.cs b/agent/bindings/csharp/ShowOptionsParams.cs deleted file mode 100644 index 352b760be510..000000000000 --- a/agent/bindings/csharp/ShowOptionsParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ShowOptionsParams - { - [JsonProperty(PropertyName = "preserveFocus")] - public bool PreserveFocus { get; set; } - [JsonProperty(PropertyName = "viewColumn")] - public int ViewColumn { get; set; } - } -} diff --git a/agent/bindings/csharp/ShowWindowMessageParams.cs b/agent/bindings/csharp/ShowWindowMessageParams.cs deleted file mode 100644 index a7ed89610c81..000000000000 --- a/agent/bindings/csharp/ShowWindowMessageParams.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class ShowWindowMessageParams - { - [JsonProperty(PropertyName = "severity")] - public SeverityEnum Severity { get; set; } // Oneof: error, warning, information - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - [JsonProperty(PropertyName = "options")] - public MessageOptions Options { get; set; } - [JsonProperty(PropertyName = "items")] - public string[] Items { get; set; } - - public enum SeverityEnum - { - [EnumMember(Value = "error")] - Error, - [EnumMember(Value = "warning")] - Warning, - [EnumMember(Value = "information")] - Information, - } - } -} diff --git a/agent/bindings/csharp/SourceParams.cs b/agent/bindings/csharp/SourceParams.cs deleted file mode 100644 index 190b23b65424..000000000000 --- a/agent/bindings/csharp/SourceParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class SourceParams - { - [JsonProperty(PropertyName = "client")] - public string Client { get; set; } - [JsonProperty(PropertyName = "clientVersion")] - public string ClientVersion { get; set; } - } -} diff --git a/agent/bindings/csharp/StartParams.cs b/agent/bindings/csharp/StartParams.cs deleted file mode 100644 index ff44bde78491..000000000000 --- a/agent/bindings/csharp/StartParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class StartParams - { - [JsonProperty(PropertyName = "line")] - public int Line { get; set; } - [JsonProperty(PropertyName = "character")] - public int Character { get; set; } - } -} diff --git a/agent/bindings/csharp/SymbolKind.cs b/agent/bindings/csharp/SymbolKind.cs deleted file mode 100644 index 6961d697b1b9..000000000000 --- a/agent/bindings/csharp/SymbolKind.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - - public enum SymbolKind - { - [EnumMember(Value = "class")] - Class, - [EnumMember(Value = "function")] - Function, - [EnumMember(Value = "method")] - Method, - } -} diff --git a/agent/bindings/csharp/TelemetryEvent.cs b/agent/bindings/csharp/TelemetryEvent.cs deleted file mode 100644 index 9ae25a040079..000000000000 --- a/agent/bindings/csharp/TelemetryEvent.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TelemetryEvent - { - [JsonProperty(PropertyName = "feature")] - public string Feature { get; set; } - [JsonProperty(PropertyName = "action")] - public string Action { get; set; } - } -} diff --git a/agent/bindings/csharp/TestingClosestPostDataParams.cs b/agent/bindings/csharp/TestingClosestPostDataParams.cs deleted file mode 100644 index 49d64e92319a..000000000000 --- a/agent/bindings/csharp/TestingClosestPostDataParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TestingClosestPostDataParams - { - [JsonProperty(PropertyName = "url")] - public string Url { get; set; } - [JsonProperty(PropertyName = "postData")] - public string PostData { get; set; } - } -} diff --git a/agent/bindings/csharp/TestingClosestPostDataResult.cs b/agent/bindings/csharp/TestingClosestPostDataResult.cs deleted file mode 100644 index c73daf61053d..000000000000 --- a/agent/bindings/csharp/TestingClosestPostDataResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TestingClosestPostDataResult - { - [JsonProperty(PropertyName = "closestBody")] - public string ClosestBody { get; set; } - } -} diff --git a/agent/bindings/csharp/TestingDiagnosticsParams.cs b/agent/bindings/csharp/TestingDiagnosticsParams.cs deleted file mode 100644 index 6a974da21a14..000000000000 --- a/agent/bindings/csharp/TestingDiagnosticsParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TestingDiagnosticsParams - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - } -} diff --git a/agent/bindings/csharp/TestingDiagnosticsResult.cs b/agent/bindings/csharp/TestingDiagnosticsResult.cs deleted file mode 100644 index 25e1554afb12..000000000000 --- a/agent/bindings/csharp/TestingDiagnosticsResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TestingDiagnosticsResult - { - [JsonProperty(PropertyName = "diagnostics")] - public ProtocolDiagnostic[] Diagnostics { get; set; } - } -} diff --git a/agent/bindings/csharp/TestingExportedTelemetryEventsResult.cs b/agent/bindings/csharp/TestingExportedTelemetryEventsResult.cs deleted file mode 100644 index 330fc9bc425f..000000000000 --- a/agent/bindings/csharp/TestingExportedTelemetryEventsResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TestingExportedTelemetryEventsResult - { - [JsonProperty(PropertyName = "events")] - public TestingTelemetryEvent[] Events { get; set; } - } -} diff --git a/agent/bindings/csharp/TestingMemoryUsageResult.cs b/agent/bindings/csharp/TestingMemoryUsageResult.cs deleted file mode 100644 index 8b36cfde2e7a..000000000000 --- a/agent/bindings/csharp/TestingMemoryUsageResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TestingMemoryUsageResult - { - [JsonProperty(PropertyName = "usage")] - public MemoryUsage Usage { get; set; } - } -} diff --git a/agent/bindings/csharp/TestingNetworkRequestsResult.cs b/agent/bindings/csharp/TestingNetworkRequestsResult.cs deleted file mode 100644 index 91795c4a50cf..000000000000 --- a/agent/bindings/csharp/TestingNetworkRequestsResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TestingNetworkRequestsResult - { - [JsonProperty(PropertyName = "requests")] - public NetworkRequest[] Requests { get; set; } - } -} diff --git a/agent/bindings/csharp/TestingParams.cs b/agent/bindings/csharp/TestingParams.cs deleted file mode 100644 index 5f80b808f842..000000000000 --- a/agent/bindings/csharp/TestingParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TestingParams - { - [JsonProperty(PropertyName = "selectedText")] - public string SelectedText { get; set; } - [JsonProperty(PropertyName = "sourceOfTruthDocument")] - public ProtocolTextDocument SourceOfTruthDocument { get; set; } - } -} diff --git a/agent/bindings/csharp/TestingProgressCancelationParams.cs b/agent/bindings/csharp/TestingProgressCancelationParams.cs deleted file mode 100644 index 94831052cd6d..000000000000 --- a/agent/bindings/csharp/TestingProgressCancelationParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TestingProgressCancelationParams - { - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - } -} diff --git a/agent/bindings/csharp/TestingProgressCancelationResult.cs b/agent/bindings/csharp/TestingProgressCancelationResult.cs deleted file mode 100644 index 47f11cacdd1f..000000000000 --- a/agent/bindings/csharp/TestingProgressCancelationResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TestingProgressCancelationResult - { - [JsonProperty(PropertyName = "result")] - public string Result { get; set; } - } -} diff --git a/agent/bindings/csharp/TestingProgressParams.cs b/agent/bindings/csharp/TestingProgressParams.cs deleted file mode 100644 index d0eea27ee315..000000000000 --- a/agent/bindings/csharp/TestingProgressParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TestingProgressParams - { - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - } -} diff --git a/agent/bindings/csharp/TestingProgressResult.cs b/agent/bindings/csharp/TestingProgressResult.cs deleted file mode 100644 index c8d0bba3ef71..000000000000 --- a/agent/bindings/csharp/TestingProgressResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TestingProgressResult - { - [JsonProperty(PropertyName = "result")] - public string Result { get; set; } - } -} diff --git a/agent/bindings/csharp/TestingRequestErrorsResult.cs b/agent/bindings/csharp/TestingRequestErrorsResult.cs deleted file mode 100644 index 43f0150a87ed..000000000000 --- a/agent/bindings/csharp/TestingRequestErrorsResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TestingRequestErrorsResult - { - [JsonProperty(PropertyName = "errors")] - public NetworkRequest[] Errors { get; set; } - } -} diff --git a/agent/bindings/csharp/TestingTelemetryEvent.cs b/agent/bindings/csharp/TestingTelemetryEvent.cs deleted file mode 100644 index ef419472297a..000000000000 --- a/agent/bindings/csharp/TestingTelemetryEvent.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TestingTelemetryEvent - { - [JsonProperty(PropertyName = "feature")] - public string Feature { get; set; } - [JsonProperty(PropertyName = "action")] - public string Action { get; set; } - [JsonProperty(PropertyName = "source")] - public SourceParams Source { get; set; } - [JsonProperty(PropertyName = "timestamp")] - public string Timestamp { get; set; } - [JsonProperty(PropertyName = "testOnlyAnonymousUserID")] - public string TestOnlyAnonymousUserID { get; set; } - } -} diff --git a/agent/bindings/csharp/TextDocumentChangeResult.cs b/agent/bindings/csharp/TextDocumentChangeResult.cs deleted file mode 100644 index 231eb694bd49..000000000000 --- a/agent/bindings/csharp/TextDocumentChangeResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TextDocumentChangeResult - { - [JsonProperty(PropertyName = "success")] - public bool Success { get; set; } - } -} diff --git a/agent/bindings/csharp/TextDocumentDidFocusParams.cs b/agent/bindings/csharp/TextDocumentDidFocusParams.cs deleted file mode 100644 index 3e2ccf1be0c8..000000000000 --- a/agent/bindings/csharp/TextDocumentDidFocusParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TextDocumentDidFocusParams - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - } -} diff --git a/agent/bindings/csharp/TextDocumentDidSaveParams.cs b/agent/bindings/csharp/TextDocumentDidSaveParams.cs deleted file mode 100644 index 9a83b267c242..000000000000 --- a/agent/bindings/csharp/TextDocumentDidSaveParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TextDocumentDidSaveParams - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - } -} diff --git a/agent/bindings/csharp/TextDocumentEditParams.cs b/agent/bindings/csharp/TextDocumentEditParams.cs deleted file mode 100644 index e093a4a773a7..000000000000 --- a/agent/bindings/csharp/TextDocumentEditParams.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TextDocumentEditParams - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "edits")] - public TextEdit[] Edits { get; set; } - [JsonProperty(PropertyName = "options")] - public OptionsParams Options { get; set; } - } -} diff --git a/agent/bindings/csharp/TextDocumentShowOptionsParams.cs b/agent/bindings/csharp/TextDocumentShowOptionsParams.cs deleted file mode 100644 index 23bd98b8c6c7..000000000000 --- a/agent/bindings/csharp/TextDocumentShowOptionsParams.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TextDocumentShowOptionsParams - { - [JsonProperty(PropertyName = "preserveFocus")] - public bool PreserveFocus { get; set; } - [JsonProperty(PropertyName = "preview")] - public bool Preview { get; set; } - [JsonProperty(PropertyName = "selection")] - public Range Selection { get; set; } - } -} diff --git a/agent/bindings/csharp/TextDocumentShowParams.cs b/agent/bindings/csharp/TextDocumentShowParams.cs deleted file mode 100644 index 6e943b686a55..000000000000 --- a/agent/bindings/csharp/TextDocumentShowParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TextDocumentShowParams - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "options")] - public TextDocumentShowOptionsParams Options { get; set; } - } -} diff --git a/agent/bindings/csharp/TextEdit.cs b/agent/bindings/csharp/TextEdit.cs deleted file mode 100644 index f4f915c6b0da..000000000000 --- a/agent/bindings/csharp/TextEdit.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - - [JsonConverter(typeof(TextEditConverter))] - public abstract class TextEdit - { - private class TextEditConverter : JsonConverter - { - public override TextEdit Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var jsonDoc = JsonDocument.ParseValue(ref reader); - var discriminator = jsonDoc.RootElement.GetProperty("type").GetString(); - switch (discriminator) - { - case "replace": - return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); - case "insert": - return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); - case "delete": - return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); - default: - throw new JsonException($"Unknown discriminator {discriminator}"); - } - } - public override void Write(Utf8JsonWriter writer, ${name} value, JsonSerializerOptions options) - { - JsonSerializer.Serialize(writer, value, value.GetType(), options); - } - } - - public class ReplaceTextEdit : TextEdit - { - [JsonProperty(PropertyName = "type")] - public TypeEnum Type { get; set; } // Oneof: replace - [JsonProperty(PropertyName = "range")] - public Range Range { get; set; } - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - [JsonProperty(PropertyName = "metadata")] - public WorkspaceEditEntryMetadata Metadata { get; set; } - - public enum TypeEnum - { - [EnumMember(Value = "replace")] - Replace, - } - } - - public class InsertTextEdit : TextEdit - { - [JsonProperty(PropertyName = "type")] - public TypeEnum Type { get; set; } // Oneof: insert - [JsonProperty(PropertyName = "position")] - public Position Position { get; set; } - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - [JsonProperty(PropertyName = "metadata")] - public WorkspaceEditEntryMetadata Metadata { get; set; } - - public enum TypeEnum - { - [EnumMember(Value = "insert")] - Insert, - } - } - - public class DeleteTextEdit : TextEdit - { - [JsonProperty(PropertyName = "type")] - public TypeEnum Type { get; set; } // Oneof: delete - [JsonProperty(PropertyName = "range")] - public Range Range { get; set; } - [JsonProperty(PropertyName = "metadata")] - public WorkspaceEditEntryMetadata Metadata { get; set; } - - public enum TypeEnum - { - [EnumMember(Value = "delete")] - Delete, - } - } - } -} diff --git a/agent/bindings/csharp/TitleParams.cs b/agent/bindings/csharp/TitleParams.cs deleted file mode 100644 index 7ebee9c49d58..000000000000 --- a/agent/bindings/csharp/TitleParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class TitleParams - { - [JsonProperty(PropertyName = "text")] - public string Text { get; set; } - [JsonProperty(PropertyName = "icons")] - public IconsParams[] Icons { get; set; } - } -} diff --git a/agent/bindings/csharp/UntitledTextDocument.cs b/agent/bindings/csharp/UntitledTextDocument.cs deleted file mode 100644 index 58c41e4cfba4..000000000000 --- a/agent/bindings/csharp/UntitledTextDocument.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class UntitledTextDocument - { - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "content")] - public string Content { get; set; } - [JsonProperty(PropertyName = "language")] - public string Language { get; set; } - } -} diff --git a/agent/bindings/csharp/Uri.cs b/agent/bindings/csharp/Uri.cs deleted file mode 100644 index 571d6a215f89..000000000000 --- a/agent/bindings/csharp/Uri.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class Uri - { - [JsonProperty(PropertyName = "scheme")] - public string Scheme { get; set; } - [JsonProperty(PropertyName = "authority")] - public string Authority { get; set; } - [JsonProperty(PropertyName = "path")] - public string Path { get; set; } - [JsonProperty(PropertyName = "query")] - public string Query { get; set; } - [JsonProperty(PropertyName = "fragment")] - public string Fragment { get; set; } - [JsonProperty(PropertyName = "fsPath")] - public string FsPath { get; set; } - } -} diff --git a/agent/bindings/csharp/WebviewCreateWebviewPanelOptions.cs b/agent/bindings/csharp/WebviewCreateWebviewPanelOptions.cs deleted file mode 100644 index 10a8ecf1ba07..000000000000 --- a/agent/bindings/csharp/WebviewCreateWebviewPanelOptions.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WebviewCreateWebviewPanelOptions - { - [JsonProperty(PropertyName = "enableScripts")] - public bool EnableScripts { get; set; } - [JsonProperty(PropertyName = "enableForms")] - public bool EnableForms { get; set; } - [JsonProperty(PropertyName = "enableOnlyCommandUris")] - public string[] EnableOnlyCommandUris { get; set; } - [JsonProperty(PropertyName = "localResourceRoots")] - public string[] LocalResourceRoots { get; set; } - [JsonProperty(PropertyName = "portMapping")] - public PortMappingParams[] PortMapping { get; set; } - [JsonProperty(PropertyName = "enableFindWidget")] - public bool EnableFindWidget { get; set; } - [JsonProperty(PropertyName = "retainContextWhenHidden")] - public bool RetainContextWhenHidden { get; set; } - } -} diff --git a/agent/bindings/csharp/WebviewCreateWebviewPanelParams.cs b/agent/bindings/csharp/WebviewCreateWebviewPanelParams.cs deleted file mode 100644 index 83051fb4748d..000000000000 --- a/agent/bindings/csharp/WebviewCreateWebviewPanelParams.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WebviewCreateWebviewPanelParams - { - [JsonProperty(PropertyName = "handle")] - public string Handle { get; set; } - [JsonProperty(PropertyName = "viewType")] - public string ViewType { get; set; } - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - [JsonProperty(PropertyName = "showOptions")] - public ShowOptionsParams ShowOptions { get; set; } - [JsonProperty(PropertyName = "options")] - public WebviewCreateWebviewPanelOptions Options { get; set; } - } -} diff --git a/agent/bindings/csharp/WebviewDidDisposeNativeParams.cs b/agent/bindings/csharp/WebviewDidDisposeNativeParams.cs deleted file mode 100644 index 38f0dd791644..000000000000 --- a/agent/bindings/csharp/WebviewDidDisposeNativeParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WebviewDidDisposeNativeParams - { - [JsonProperty(PropertyName = "handle")] - public string Handle { get; set; } - } -} diff --git a/agent/bindings/csharp/WebviewDidDisposeParams.cs b/agent/bindings/csharp/WebviewDidDisposeParams.cs deleted file mode 100644 index d3ba99421162..000000000000 --- a/agent/bindings/csharp/WebviewDidDisposeParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WebviewDidDisposeParams - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - } -} diff --git a/agent/bindings/csharp/WebviewDisposeParams.cs b/agent/bindings/csharp/WebviewDisposeParams.cs deleted file mode 100644 index 0c9ba41e876b..000000000000 --- a/agent/bindings/csharp/WebviewDisposeParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WebviewDisposeParams - { - [JsonProperty(PropertyName = "handle")] - public string Handle { get; set; } - } -} diff --git a/agent/bindings/csharp/WebviewNativeConfigParams.cs b/agent/bindings/csharp/WebviewNativeConfigParams.cs deleted file mode 100644 index de76503e089d..000000000000 --- a/agent/bindings/csharp/WebviewNativeConfigParams.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WebviewNativeConfigParams - { - [JsonProperty(PropertyName = "view")] - public ViewEnum View { get; set; } // Oneof: multiple, single - [JsonProperty(PropertyName = "cspSource")] - public string CspSource { get; set; } - [JsonProperty(PropertyName = "webviewBundleServingPrefix")] - public string WebviewBundleServingPrefix { get; set; } - [JsonProperty(PropertyName = "rootDir")] - public string RootDir { get; set; } - [JsonProperty(PropertyName = "injectScript")] - public string InjectScript { get; set; } - [JsonProperty(PropertyName = "injectStyle")] - public string InjectStyle { get; set; } - - public enum ViewEnum - { - [EnumMember(Value = "multiple")] - Multiple, - [EnumMember(Value = "single")] - Single, - } - } -} diff --git a/agent/bindings/csharp/WebviewPostMessageStringEncodedParams.cs b/agent/bindings/csharp/WebviewPostMessageStringEncodedParams.cs deleted file mode 100644 index b4a874779f93..000000000000 --- a/agent/bindings/csharp/WebviewPostMessageStringEncodedParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WebviewPostMessageStringEncodedParams - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - [JsonProperty(PropertyName = "stringEncodedMessage")] - public string StringEncodedMessage { get; set; } - } -} diff --git a/agent/bindings/csharp/WebviewReceiveMessageStringEncodedParams.cs b/agent/bindings/csharp/WebviewReceiveMessageStringEncodedParams.cs deleted file mode 100644 index 3358e30c9f16..000000000000 --- a/agent/bindings/csharp/WebviewReceiveMessageStringEncodedParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WebviewReceiveMessageStringEncodedParams - { - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - [JsonProperty(PropertyName = "messageStringEncoded")] - public string MessageStringEncoded { get; set; } - } -} diff --git a/agent/bindings/csharp/WebviewRegisterWebviewViewProviderParams.cs b/agent/bindings/csharp/WebviewRegisterWebviewViewProviderParams.cs deleted file mode 100644 index f9454294b5f7..000000000000 --- a/agent/bindings/csharp/WebviewRegisterWebviewViewProviderParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WebviewRegisterWebviewViewProviderParams - { - [JsonProperty(PropertyName = "viewId")] - public string ViewId { get; set; } - [JsonProperty(PropertyName = "retainContextWhenHidden")] - public bool RetainContextWhenHidden { get; set; } - } -} diff --git a/agent/bindings/csharp/WebviewResolveWebviewViewParams.cs b/agent/bindings/csharp/WebviewResolveWebviewViewParams.cs deleted file mode 100644 index 1c7429f4a381..000000000000 --- a/agent/bindings/csharp/WebviewResolveWebviewViewParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WebviewResolveWebviewViewParams - { - [JsonProperty(PropertyName = "viewId")] - public string ViewId { get; set; } - [JsonProperty(PropertyName = "webviewHandle")] - public string WebviewHandle { get; set; } - } -} diff --git a/agent/bindings/csharp/WebviewRevealParams.cs b/agent/bindings/csharp/WebviewRevealParams.cs deleted file mode 100644 index aa30a815f8c1..000000000000 --- a/agent/bindings/csharp/WebviewRevealParams.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WebviewRevealParams - { - [JsonProperty(PropertyName = "handle")] - public string Handle { get; set; } - [JsonProperty(PropertyName = "viewColumn")] - public int ViewColumn { get; set; } - [JsonProperty(PropertyName = "preserveFocus")] - public bool PreserveFocus { get; set; } - } -} diff --git a/agent/bindings/csharp/WebviewSetHtmlParams.cs b/agent/bindings/csharp/WebviewSetHtmlParams.cs deleted file mode 100644 index ca61514c1dfb..000000000000 --- a/agent/bindings/csharp/WebviewSetHtmlParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WebviewSetHtmlParams - { - [JsonProperty(PropertyName = "handle")] - public string Handle { get; set; } - [JsonProperty(PropertyName = "html")] - public string Html { get; set; } - } -} diff --git a/agent/bindings/csharp/WebviewSetIconPathParams.cs b/agent/bindings/csharp/WebviewSetIconPathParams.cs deleted file mode 100644 index 797ae7b864ca..000000000000 --- a/agent/bindings/csharp/WebviewSetIconPathParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WebviewSetIconPathParams - { - [JsonProperty(PropertyName = "handle")] - public string Handle { get; set; } - [JsonProperty(PropertyName = "iconPathUri")] - public string IconPathUri { get; set; } - } -} diff --git a/agent/bindings/csharp/WebviewSetOptionsParams.cs b/agent/bindings/csharp/WebviewSetOptionsParams.cs deleted file mode 100644 index f2051d7521df..000000000000 --- a/agent/bindings/csharp/WebviewSetOptionsParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WebviewSetOptionsParams - { - [JsonProperty(PropertyName = "handle")] - public string Handle { get; set; } - [JsonProperty(PropertyName = "options")] - public DefiniteWebviewOptions Options { get; set; } - } -} diff --git a/agent/bindings/csharp/WebviewSetTitleParams.cs b/agent/bindings/csharp/WebviewSetTitleParams.cs deleted file mode 100644 index f49bdff1ac43..000000000000 --- a/agent/bindings/csharp/WebviewSetTitleParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WebviewSetTitleParams - { - [JsonProperty(PropertyName = "handle")] - public string Handle { get; set; } - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - } -} diff --git a/agent/bindings/csharp/WindowDidChangeContextParams.cs b/agent/bindings/csharp/WindowDidChangeContextParams.cs deleted file mode 100644 index c35a3b6d1fec..000000000000 --- a/agent/bindings/csharp/WindowDidChangeContextParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WindowDidChangeContextParams - { - [JsonProperty(PropertyName = "key")] - public string Key { get; set; } - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - } -} diff --git a/agent/bindings/csharp/WorkspaceEditEntryMetadata.cs b/agent/bindings/csharp/WorkspaceEditEntryMetadata.cs deleted file mode 100644 index 061d6ebd036e..000000000000 --- a/agent/bindings/csharp/WorkspaceEditEntryMetadata.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WorkspaceEditEntryMetadata - { - [JsonProperty(PropertyName = "needsConfirmation")] - public bool NeedsConfirmation { get; set; } - [JsonProperty(PropertyName = "label")] - public string Label { get; set; } - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - [JsonProperty(PropertyName = "iconPath")] - public Uri IconPath { get; set; } - } -} diff --git a/agent/bindings/csharp/WorkspaceEditMetadata.cs b/agent/bindings/csharp/WorkspaceEditMetadata.cs deleted file mode 100644 index 79053693de76..000000000000 --- a/agent/bindings/csharp/WorkspaceEditMetadata.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WorkspaceEditMetadata - { - [JsonProperty(PropertyName = "isRefactoring")] - public bool IsRefactoring { get; set; } - } -} diff --git a/agent/bindings/csharp/WorkspaceEditOperation.cs b/agent/bindings/csharp/WorkspaceEditOperation.cs deleted file mode 100644 index 265d71d7e525..000000000000 --- a/agent/bindings/csharp/WorkspaceEditOperation.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - - [JsonConverter(typeof(WorkspaceEditOperationConverter))] - public abstract class WorkspaceEditOperation - { - private class WorkspaceEditOperationConverter : JsonConverter - { - public override WorkspaceEditOperation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var jsonDoc = JsonDocument.ParseValue(ref reader); - var discriminator = jsonDoc.RootElement.GetProperty("type").GetString(); - switch (discriminator) - { - case "create-file": - return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); - case "rename-file": - return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); - case "delete-file": - return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); - case "edit-file": - return JsonSerializer.Deserialize(jsonDoc.RootElement.GetRawText(), options); - default: - throw new JsonException($"Unknown discriminator {discriminator}"); - } - } - public override void Write(Utf8JsonWriter writer, ${name} value, JsonSerializerOptions options) - { - JsonSerializer.Serialize(writer, value, value.GetType(), options); - } - } - - public class CreateFileOperation : WorkspaceEditOperation - { - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } // Oneof: create-file - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "options")] - public WriteFileOptions Options { get; set; } - [JsonProperty(PropertyName = "textContents")] - public string TextContents { get; set; } - [JsonProperty(PropertyName = "metadata")] - public WorkspaceEditEntryMetadata Metadata { get; set; } - } - - public class RenameFileOperation : WorkspaceEditOperation - { - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } // Oneof: rename-file - [JsonProperty(PropertyName = "oldUri")] - public string OldUri { get; set; } - [JsonProperty(PropertyName = "newUri")] - public string NewUri { get; set; } - [JsonProperty(PropertyName = "options")] - public WriteFileOptions Options { get; set; } - [JsonProperty(PropertyName = "metadata")] - public WorkspaceEditEntryMetadata Metadata { get; set; } - } - - public class DeleteFileOperation : WorkspaceEditOperation - { - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } // Oneof: delete-file - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "deleteOptions")] - public DeleteOptionsParams DeleteOptions { get; set; } - [JsonProperty(PropertyName = "metadata")] - public WorkspaceEditEntryMetadata Metadata { get; set; } - } - - public class EditFileOperation : WorkspaceEditOperation - { - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } // Oneof: edit-file - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - [JsonProperty(PropertyName = "edits")] - public TextEdit[] Edits { get; set; } - } - } -} diff --git a/agent/bindings/csharp/WorkspaceEditParams.cs b/agent/bindings/csharp/WorkspaceEditParams.cs deleted file mode 100644 index 3c8c98a99e85..000000000000 --- a/agent/bindings/csharp/WorkspaceEditParams.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WorkspaceEditParams - { - [JsonProperty(PropertyName = "operations")] - public WorkspaceEditOperation[] Operations { get; set; } - [JsonProperty(PropertyName = "metadata")] - public WorkspaceEditMetadata Metadata { get; set; } - } -} diff --git a/agent/bindings/csharp/WorkspaceFolderDidChangeParams.cs b/agent/bindings/csharp/WorkspaceFolderDidChangeParams.cs deleted file mode 100644 index ee697485318f..000000000000 --- a/agent/bindings/csharp/WorkspaceFolderDidChangeParams.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WorkspaceFolderDidChangeParams - { - [JsonProperty(PropertyName = "uris")] - public string[] Uris { get; set; } - } -} diff --git a/agent/bindings/csharp/WriteFileOptions.cs b/agent/bindings/csharp/WriteFileOptions.cs deleted file mode 100644 index 310c3026f2eb..000000000000 --- a/agent/bindings/csharp/WriteFileOptions.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Cody.Core.Agent.Protocol -{ - public class WriteFileOptions - { - [JsonProperty(PropertyName = "overwrite")] - public bool Overwrite { get; set; } - [JsonProperty(PropertyName = "ignoreIfExists")] - public bool IgnoreIfExists { get; set; } - } -} diff --git a/agent/src/cli/scip-codegen/emitters/CSharpEmitter.ts b/agent/src/cli/scip-codegen/emitters/CSharpEmitter.ts index aa40e7e605ca..e385db8d4968 100644 --- a/agent/src/cli/scip-codegen/emitters/CSharpEmitter.ts +++ b/agent/src/cli/scip-codegen/emitters/CSharpEmitter.ts @@ -27,7 +27,7 @@ export class CSharpEmitter implements Emitter { } emitSerializationAdapter(p: CodePrinter, discriminatedUnions: string[]): void { - p.line(`namespace ${this.options.kotlinPackage}`) + p.line(`namespace ${this.options.kotlinPackage};`) p.line('{') p.block(() => { p.line('public static class ProtocolTypeAdapters') @@ -103,7 +103,7 @@ export class CSharpEmitter implements Emitter { } startType(p: CodePrinter, _: TypeOptions): void { - p.addImport('using Newtonsoft.Json;') + this.addJsonImport(p) p.line() p.line(`namespace ${this.options.kotlinPackage}`) p.line('{') @@ -137,60 +137,70 @@ export class CSharpEmitter implements Emitter { p.line(`public class ${name} : ${alias} {}`) } }) - - p.line('}') } startSealedClass(p: CodePrinter, { name, union }: SealedClassOptions): void { - p.addImport('using Newtonsoft.Json;') - p.line(`[JsonConverter(typeof(${name}Converter))]`) - name = name.split(/[ -]/).map(capitalize).join('') - p.line(`public abstract class ${name}`) - p.line('{') + this.addJsonImport(p) + p.line() p.block(() => { - p.line(`private class ${name}Converter : JsonConverter<${name}>`) + p.line(`[JsonConverter(typeof(${name}Converter))]`) + name = name.split(/[ -]/).map(capitalize).join('') + p.line(`public abstract class ${name}`) p.line('{') p.block(() => { - p.line( - `public override ${name} Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)` - ) - p.line('{') p.block(() => { - p.line('var jsonDoc = JsonDocument.ParseValue(ref reader);') - p.line( - `var discriminator = jsonDoc.RootElement.GetProperty("${union.discriminatorDisplayName}").GetString();` - ) - p.line('switch (discriminator)') + p.line(`private class ${name}Converter : JsonConverter<${name}>`) p.line('{') p.block(() => { - for (const member of union.members) { - const typeName = this.formatter.discriminatedUnionTypeName(union, member) - p.line(`case "${member.value}":`) + p.line( + `public override ${name} Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)` + ) + p.line('{') + p.block(() => { + p.line('var jsonDoc = JsonDocument.ParseValue(ref reader);') + p.line( + `var discriminator = jsonDoc.RootElement.GetProperty("${union.discriminatorDisplayName}").GetString();` + ) + p.line('switch (discriminator)') + p.line('{') p.block(() => { - p.line( - `return JsonSerializer.Deserialize<${typeName}>(jsonDoc.RootElement.GetRawText(), options);` - ) + for (const member of union.members) { + const typeName = this.formatter.discriminatedUnionTypeName( + union, + member + ) + p.line(`case "${member.value}":`) + p.block(() => { + p.line( + `return JsonSerializer.Deserialize<${typeName}>(jsonDoc.RootElement.GetRawText(), options);` + ) + }) + } + p.line('default:') + p.block(() => { + p.line( + 'throw new JsonException($"Unknown discriminator {discriminator}");' + ) + }) + p.line('}') }) - } - p.line('default:') - p.block(() => { - p.line('throw new JsonException($"Unknown discriminator {discriminator}");') }) p.line('}') - }) + p.line() - p.line( - `public override void Write(Utf8JsonWriter writer, ${name} value, JsonSerializerOptions options` - ) - p.line('{') - p.block(() => - p.line('JsonSerializer.Serialize(writer, value, value.GetType(), options);') - ) + p.line( + `public override void Write(Utf8JsonWriter writer, ${name} value, JsonSerializerOptions options)` + ) + p.line('{') + p.block(() => + p.line('JsonSerializer.Serialize(writer, value, value.GetType(), options);') + ) + p.line('}') + }) p.line('}') }) }) - p.line('}') }) } @@ -200,7 +210,7 @@ export class CSharpEmitter implements Emitter { emitDataClass( p: CodePrinter, - { name, members, enums, parentClass, isStringType }: DataClassOptions + { name, members, enums, parentClass, isStringType, innerClass }: DataClassOptions ): void { // Special case for string types if (isStringType) { @@ -212,30 +222,35 @@ export class CSharpEmitter implements Emitter { } return } + if (innerClass) { + p.line() + } const heritage = parentClass ? ` : ${parentClass}` : '' - p.line(`public class ${name}${heritage}`) - p.line('{') p.block(() => { - for (const { info, typeSyntax, formattedName, oneOfComment } of members) { - p.line(`[JsonProperty(PropertyName = "${info.display_name}")]`) - if (oneOfComment.includes('-')) { - p.line(`public string ${formattedName} { get; set; }${oneOfComment}`) - } else { - p.line(`public ${typeSyntax} ${formattedName} { get; set; }${oneOfComment}`) + p.line(`public class ${name}${heritage}`) + p.line('{') + p.block(() => { + for (const { info, typeSyntax, formattedName, oneOfComment } of members) { + p.line(`[JsonProperty(PropertyName = "${info.display_name}")]`) + if (oneOfComment.includes('-')) { + p.line(`public string ${formattedName} { get; set; }${oneOfComment}`) + } else { + p.line(`public ${typeSyntax} ${formattedName} { get; set; }${oneOfComment}`) + } } - } - if (members.length === 0) { - p.line('public string PlaceholderField { get; set; } // Empty class') - } - }) + if (members.length === 0) { + p.line('public string PlaceholderField { get; set; } // Empty class') + } + if (enums.length > 0) { + this.addJsonImport(p) + for (const enum_ of enums) { + this.emitEnum(p, enum_) + } + } + }) - if (enums.length > 0) { - p.addImport('using Newtonsoft.Json;') - for (const enum_ of enums) { - this.emitEnum(p, enum_) - } - } - p.line('}') + p.line('}') + }) } emitEnum(p: CodePrinter, { name, members }: Enum): void { @@ -244,7 +259,8 @@ export class CSharpEmitter implements Emitter { p.line('{') p.block(() => { for (const { serializedName, formattedName } of members) { - p.line(`${formattedName}, // ${serializedName}`) + p.line(`[EnumMember(Value = "${serializedName}")]`) + p.line(`${formattedName},`) } }) p.line('}') @@ -257,15 +273,21 @@ export class CSharpEmitter implements Emitter { getFileNameForType(tpe: string): string { return `${tpe}.${this.getFileType()}`.split('_').map(capitalize).join('') } + + private addJsonImport(p: CodePrinter): void { + // p.addImport('using Newtonsoft.Json;') + p.addImport('using System.Text.Json.Serialization;') + } } export class CSharpFormatter extends Formatter { override options: LanguageOptions = { typeNameSeparator: '', - typeAnnotations: 'after', + typeAnnotations: 'before', voidType: 'Void', reserved: new Set(), keywordOverrides: new Map([ + [TypescriptKeyword.Null, 'Void'], [TypescriptKeyword.Boolean, 'bool'], [TypescriptKeyword.String, 'string'], [TypescriptKeyword.Long, 'int'], From 9f3da6c45545a687e72d99bcc534d632a180ecaf Mon Sep 17 00:00:00 2001 From: jamesmcnamara Date: Wed, 9 Oct 2024 17:32:16 -0700 Subject: [PATCH 04/10] re-added agent bindings ci --- .github/workflows/agent-bindings.yml | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/agent-bindings.yml diff --git a/.github/workflows/agent-bindings.yml b/.github/workflows/agent-bindings.yml new file mode 100644 index 000000000000..7a15a792d99d --- /dev/null +++ b/.github/workflows/agent-bindings.yml @@ -0,0 +1,38 @@ +# Please post in #team-cody-clients if you need help getting this CI check to pass. +# Worst-case: feel free to disable this workflow here https://github.com/sourcegraph/cody/actions/workflows/agent-bindings.yml +name: agent-bindings +on: + + pull_request: + paths: + - '**.ts' + - '**.tsx' + - '**.js' + +jobs: + kotlin: + if: github.repository == 'sourcegraph/cody' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # SECURITY: pin third-party action hashes + 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: pnpm generate-agent-kotlin-bindings + - run: ./agent/scripts/error-if-diff.sh + - run: ./agent/scripts/compile-bindings-if-diff.sh From cb7e17680f02891dc098d40ff0f6b999515f9db6 Mon Sep 17 00:00:00 2001 From: jamesmcnamara Date: Wed, 9 Oct 2024 17:45:51 -0700 Subject: [PATCH 05/10] capitalize filename --- agent/src/cli/scip-codegen/emitters/CSharpEmitter.ts | 1 - agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/src/cli/scip-codegen/emitters/CSharpEmitter.ts b/agent/src/cli/scip-codegen/emitters/CSharpEmitter.ts index e385db8d4968..b89e0d9a93ce 100644 --- a/agent/src/cli/scip-codegen/emitters/CSharpEmitter.ts +++ b/agent/src/cli/scip-codegen/emitters/CSharpEmitter.ts @@ -275,7 +275,6 @@ export class CSharpEmitter implements Emitter { } private addJsonImport(p: CodePrinter): void { - // p.addImport('using Newtonsoft.Json;') p.addImport('using System.Text.Json.Serialization;') } } diff --git a/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts b/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts index d5416e7dd14b..ee2efe4f552c 100644 --- a/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts +++ b/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts @@ -1,3 +1,4 @@ +import { capitalize } from 'lodash' import type { CodePrinter } from '../../../../../vscode/src/completions/context/retrievers/tsc/CodePrinter' import { type ConstantType, type DiscriminatedUnion, typeOfUnion } from '../BaseCodegen' import type { Codegen } from '../Codegen' @@ -226,7 +227,7 @@ export class KotlinEmitter implements Emitter { } getFileNameForType(tpe: string): string { - return `${tpe}.${this.getFileType()}` + return `${capitalize(tpe)}.${this.getFileType()}` } getFileType(): string { From 84afca9ed9ead020d07f10093df1b155393139a0 Mon Sep 17 00:00:00 2001 From: jamesmcnamara Date: Thu, 10 Oct 2024 11:00:20 -0700 Subject: [PATCH 06/10] added loud logging to determine error --- agent/scripts/generate-agent-kotlin-bindings.sh | 12 +++++++----- agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/agent/scripts/generate-agent-kotlin-bindings.sh b/agent/scripts/generate-agent-kotlin-bindings.sh index 8e0d49e30c0c..a4fdb5a7b03c 100755 --- a/agent/scripts/generate-agent-kotlin-bindings.sh +++ b/agent/scripts/generate-agent-kotlin-bindings.sh @@ -2,11 +2,11 @@ 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 +if [ ! -d "$INDEXER_DIR" ]; then + git clone https://github.com/sourcegraph/scip-typescript.git "$INDEXER_DIR" fi -pushd $INDEXER_DIR +pushd "$INDEXER_DIR" git fetch origin git checkout olafurpg/signatures-rebase1 git pull origin olafurpg/signatures-rebase1 @@ -16,5 +16,7 @@ popd pnpm install --prefer-offline pnpm build # TODO: invoke @sourcegraph/scip-typescript npm package instead -pnpm exec ts-node $INDEXER_DIR/src/main.ts index --emit-signatures --emit-external-symbols -pnpm exec ts-node agent/src/cli/scip-codegen/command.ts --output agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated \ No newline at end of file +pnpm exec ts-node "$INDEXER_DIR"/src/main.ts index --emit-signatures --emit-external-symbols +ls agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated +pnpm exec ts-node agent/src/cli/scip-codegen/command.ts --output agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated +ls agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated diff --git a/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts b/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts index ee2efe4f552c..d4567c171376 100644 --- a/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts +++ b/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts @@ -227,6 +227,7 @@ export class KotlinEmitter implements Emitter { } getFileNameForType(tpe: string): string { + console.log('generating file', `${capitalize(tpe)}.${this.getFileType()}`) return `${capitalize(tpe)}.${this.getFileType()}` } From 509a32fc21e5ae54f961fbb6726fc2989734d34d Mon Sep 17 00:00:00 2001 From: jamesmcnamara Date: Thu, 10 Oct 2024 11:05:36 -0700 Subject: [PATCH 07/10] switched capitalize --- agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts b/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts index d4567c171376..b412d47fcfcc 100644 --- a/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts +++ b/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts @@ -1,11 +1,10 @@ -import { capitalize } from 'lodash' import type { CodePrinter } from '../../../../../vscode/src/completions/context/retrievers/tsc/CodePrinter' import { type ConstantType, type DiscriminatedUnion, typeOfUnion } from '../BaseCodegen' import type { Codegen } from '../Codegen' import { Formatter, type LanguageOptions } from '../Formatter' import type { SymbolTable } from '../SymbolTable' import type { CodegenOptions } from '../command' -import { TypescriptKeyword } from '../utils' +import { TypescriptKeyword, capitalize } from '../utils' import type { DataClassOptions, Emitter, From 5eb848475f6ba98871ea87f977a786e32020bd3c Mon Sep 17 00:00:00 2001 From: jamesmcnamara Date: Thu, 10 Oct 2024 11:40:42 -0700 Subject: [PATCH 08/10] incorporated olaf's changes --- .../scripts/generate-agent-kotlin-bindings.sh | 2 - agent/scripts/test-agent-binary.ts | 2 +- agent/src/agent.ts | 11 ++-- agent/src/cli/scip-codegen/BaseCodegen.ts | 7 +-- agent/src/cli/scip-codegen/Codegen.ts | 29 +++++++++- agent/src/cli/scip-codegen/Formatter.ts | 16 ++++++ .../scip-codegen/emitters/KotlinEmitter.ts | 1 - agent/src/currentProtocolAuthStatus.ts | 27 ++++++++++ agent/src/enterprise-demo.test.ts | 5 +- agent/src/enterprise-s2.test.ts | 5 +- agent/src/index.test.ts | 18 +++---- vscode/src/jsonrpc/agent-protocol.ts | 54 +++++++++++++++++-- 12 files changed, 150 insertions(+), 27 deletions(-) create mode 100644 agent/src/currentProtocolAuthStatus.ts diff --git a/agent/scripts/generate-agent-kotlin-bindings.sh b/agent/scripts/generate-agent-kotlin-bindings.sh index a4fdb5a7b03c..562359f4b0ae 100755 --- a/agent/scripts/generate-agent-kotlin-bindings.sh +++ b/agent/scripts/generate-agent-kotlin-bindings.sh @@ -17,6 +17,4 @@ pnpm install --prefer-offline pnpm build # TODO: invoke @sourcegraph/scip-typescript npm package instead pnpm exec ts-node "$INDEXER_DIR"/src/main.ts index --emit-signatures --emit-external-symbols -ls agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated pnpm exec ts-node agent/src/cli/scip-codegen/command.ts --output agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated -ls agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated diff --git a/agent/scripts/test-agent-binary.ts b/agent/scripts/test-agent-binary.ts index 264a31298fd7..cb4bdf4f3261 100644 --- a/agent/scripts/test-agent-binary.ts +++ b/agent/scripts/test-agent-binary.ts @@ -49,7 +49,7 @@ async function main() { customHeaders: {}, }) - if (!valid?.authenticated) { + if (valid?.status !== 'authenticated') { throw new Error('Failed to authenticate') } diff --git a/agent/src/agent.ts b/agent/src/agent.ts index c488d0a1ede5..829c50f92b61 100644 --- a/agent/src/agent.ts +++ b/agent/src/agent.ts @@ -10,7 +10,6 @@ import { ModelUsage, currentAuthStatus, currentAuthStatusAuthed, - currentAuthStatusOrNotReadyYet, firstResultFromOperation, telemetryRecorder, waitUntilComplete, @@ -78,6 +77,10 @@ import { AgentWorkspaceDocuments } from './AgentWorkspaceDocuments' import { registerNativeWebviewHandlers, resolveWebviewView } from './NativeWebview' import type { PollyRequestError } from './cli/command-jsonrpc-stdio' import { codyPaths } from './codyPaths' +import { + currentProtocolAuthStatus, + currentProtocolAuthStatusOrNotReadyYet, +} from './currentProtocolAuthStatus' import { AgentGlobalState } from './global-state/AgentGlobalState' import { MessageHandler, @@ -473,7 +476,7 @@ export class Agent extends MessageHandler implements ExtensionClient { this.registerWebviewHandlers() } - const authStatus = currentAuthStatusOrNotReadyYet() + const authStatus = currentProtocolAuthStatusOrNotReadyYet() return { name: 'cody-agent', authenticated: authStatus?.authenticated ?? false, @@ -571,12 +574,12 @@ export class Agent extends MessageHandler implements ExtensionClient { this.registerRequest('extensionConfiguration/change', async config => { this.authenticationPromise = this.handleConfigChanges(config) await this.authenticationPromise - return currentAuthStatus() + return currentProtocolAuthStatus() }) this.registerRequest('extensionConfiguration/status', async () => { await this.authenticationPromise - return currentAuthStatus() + return currentProtocolAuthStatus() }) this.registerRequest('extensionConfiguration/getSettingsSchema', async () => { diff --git a/agent/src/cli/scip-codegen/BaseCodegen.ts b/agent/src/cli/scip-codegen/BaseCodegen.ts index 8a2ff8954498..7049010d431d 100644 --- a/agent/src/cli/scip-codegen/BaseCodegen.ts +++ b/agent/src/cli/scip-codegen/BaseCodegen.ts @@ -222,6 +222,9 @@ export abstract class BaseCodegen { for (const sibling of this.siblingDiscriminatedUnionProperties.get(info.symbol) ?? []) { visitInfo(this.symtab.info(sibling)) } + if (!info.has_signature) { + return + } if (info.signature.has_value_signature) { visitType(info.signature.value_signature.tpe) return @@ -300,8 +303,6 @@ export abstract class BaseCodegen { // 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 [] + throw new TypeError(`type has no properties: ${this.debug(type)}`) } } diff --git a/agent/src/cli/scip-codegen/Codegen.ts b/agent/src/cli/scip-codegen/Codegen.ts index 41916c93b410..ee1c1904ab35 100644 --- a/agent/src/cli/scip-codegen/Codegen.ts +++ b/agent/src/cli/scip-codegen/Codegen.ts @@ -181,6 +181,20 @@ export class Codegen extends BaseCodegen { name: string, info: scip.SymbolInformation, params?: Partial + ): Promise { + try { + await this.writeDataClassUnsafe({ p, f, symtab }, name, info, params) + } catch (e) { + const errorMessage = `Failed to handle class ${info.symbol}. To fix this problem, consider skipping this type by adding the symbol to "ignoredInfoSymbol" in Formatter.ts\n${e}` + this.reporter.error(info.symbol, errorMessage) + } + } + + private async writeDataClassUnsafe( + { p, f, symtab }: DocumentContext, + name: string, + info: scip.SymbolInformation, + params?: Partial ): Promise { if (info.kind === scip.SymbolInformation.Kind.Class) { this.reporter.warn( @@ -255,7 +269,14 @@ export class Codegen extends BaseCodegen { })), }) } else { - this.queueClassLikeType(memberType, member, 'parameter') + try { + this.queueClassLikeType(memberType, member, 'parameter') + } catch (error) { + const stack = error instanceof Error ? '\n' + error.stack : '' + const errorMessage = `error handling member: ${member.symbol}. To fix this problem, you may want to ignore it from code generation by adding the symbol name to the "ignoredProperties" in the Formatter.ts file.\n${error}${stack}` + this.reporter.error(memberSymbol, errorMessage) + continue + } } const oneofSyntax = constants.length > 0 ? ' // Oneof: ' + constants.join(', ') : '' const fieldName = this.emitter.formatter.formatFieldName(member.display_name) @@ -299,6 +320,9 @@ export class Codegen extends BaseCodegen { const { f, p, c } = this.startDocument() const name = f.typeName(info) const alias = this.aliasType(info) + if (f.isIgnoredInfo(info)) { + return + } this.emitter.startType(p, { name, info }) if (alias) { const isStringType = this.isStringTypeInfo(info) @@ -572,6 +596,9 @@ export class Codegen extends BaseCodegen { // Same as `queueClassLikeType` but for `scip.SymbolInformation` instead of `scip.Type`. private queueClassLikeInfo(jsonrpcMethod: scip.SymbolInformation): void { + if (!jsonrpcMethod.has_signature) { + return + } if (jsonrpcMethod.signature.has_class_signature) { // Easy, this looks like a class/interface. this.queue.push(jsonrpcMethod) diff --git a/agent/src/cli/scip-codegen/Formatter.ts b/agent/src/cli/scip-codegen/Formatter.ts index 1be2c480f12f..79e25c723b4c 100644 --- a/agent/src/cli/scip-codegen/Formatter.ts +++ b/agent/src/cli/scip-codegen/Formatter.ts @@ -175,10 +175,17 @@ export abstract class Formatter { ) } + public readonly ignoredInfoSymbol: string[] = [] + public readonly ignoredProperties = [ 'npm @sourcegraph/telemetry ', // Too many complicated types from this package + '`inline-completion-item-provider-config-singleton.ts`/tracer0:', + '`observable.d.ts`/Subscription#', + '`provider.ts`/Provider#configSource', + '`StatusBar.ts`/CodyStatusBar', ] private readonly ignoredTypeRefs = [ + '`provider.ts`/Provider#', 'npm @sourcegraph/telemetry', // Too many complicated types from this package '/TelemetryEventParameters#', ' lib/`lib.es5.d.ts`/Omit#', @@ -198,6 +205,15 @@ export abstract class Formatter { return false } + public isIgnoredInfo(info: scip.SymbolInformation): boolean { + for (const ignored of this.ignoredInfoSymbol) { + if (info.symbol.includes(ignored)) { + return true + } + } + return false + } + // 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. diff --git a/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts b/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts index b412d47fcfcc..53bb019fefd5 100644 --- a/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts +++ b/agent/src/cli/scip-codegen/emitters/KotlinEmitter.ts @@ -226,7 +226,6 @@ export class KotlinEmitter implements Emitter { } getFileNameForType(tpe: string): string { - console.log('generating file', `${capitalize(tpe)}.${this.getFileType()}`) return `${capitalize(tpe)}.${this.getFileType()}` } diff --git a/agent/src/currentProtocolAuthStatus.ts b/agent/src/currentProtocolAuthStatus.ts new file mode 100644 index 000000000000..b83624d838df --- /dev/null +++ b/agent/src/currentProtocolAuthStatus.ts @@ -0,0 +1,27 @@ +import { type AuthStatus, currentAuthStatus } from '@sourcegraph/cody-shared' +import type { ProtocolAuthStatus } from './protocol-alias' + +export function toProtocolAuthStatus(status: AuthStatus): ProtocolAuthStatus { + if (status.authenticated) { + return { + status: 'authenticated', + ...status, + } + } + return { + status: 'unauthenticated', + ...status, + } +} + +export function currentProtocolAuthStatus(): ProtocolAuthStatus { + return toProtocolAuthStatus(currentAuthStatus()) +} + +export function currentProtocolAuthStatusOrNotReadyYet(): ProtocolAuthStatus | undefined { + const status = currentAuthStatus() + if (status) { + return toProtocolAuthStatus(status) + } + return undefined +} diff --git a/agent/src/enterprise-demo.test.ts b/agent/src/enterprise-demo.test.ts index bc44c8326163..531b3d839835 100644 --- a/agent/src/enterprise-demo.test.ts +++ b/agent/src/enterprise-demo.test.ts @@ -22,7 +22,10 @@ describe('Enterprise', () => { if (!serverInfo.authStatus?.authenticated) { throw new Error('unreachable') } - expect(serverInfo.authStatus?.username).toStrictEqual('codytesting') + expect(serverInfo.authStatus?.status).toStrictEqual('authenticated') + if (serverInfo.authStatus?.status === 'authenticated') { + expect(serverInfo.authStatus?.username).toStrictEqual('codytesting') + } }, 10_000) // Skip because it consistently fails with: diff --git a/agent/src/enterprise-s2.test.ts b/agent/src/enterprise-s2.test.ts index c0264a45dbd5..46a64bfa6a9b 100644 --- a/agent/src/enterprise-s2.test.ts +++ b/agent/src/enterprise-s2.test.ts @@ -39,7 +39,10 @@ describe('Enterprise - S2 (close main branch)', { timeout: 5000 }, () => { if (!serverInfo.authStatus?.authenticated) { throw new Error('unreachable') } - expect(serverInfo.authStatus?.username).toStrictEqual('codytesting') + expect(serverInfo.authStatus?.status).toStrictEqual('authenticated') + if (serverInfo.authStatus?.status === 'authenticated') { + expect(serverInfo.authStatus?.username).toStrictEqual('codytesting') + } }, 10_000) it('creates an autocomplete provider using server-side model config from S2', async () => { diff --git a/agent/src/index.test.ts b/agent/src/index.test.ts index b3191cb35aea..4a97b48206ff 100644 --- a/agent/src/index.test.ts +++ b/agent/src/index.test.ts @@ -154,8 +154,8 @@ describe('Agent', () => { serverEndpoint: client.info.extensionConfiguration?.serverEndpoint ?? DOTCOM_URL.toString(), customHeaders: {}, }) - expect(valid?.authenticated).toBeTruthy() - if (!valid?.authenticated) { + expect(valid?.status).toEqual('authenticated') + if (valid?.status !== 'authenticated') { throw new Error('unreachable') } @@ -174,7 +174,7 @@ describe('Agent', () => { // source agent/scripts/export-cody-http-recording-tokens.sh // // If you don't have access to this private file then you need to ask - expect(valid?.username).toStrictEqual('sourcegraphbot9k-fnwmu') + expect(valid.username).toStrictEqual('sourcegraphbot9k-fnwmu') // telemetry assertion, to validate the expected events fired during the test run // Do not remove this assertion, and instead update the expectedEvents list above @@ -254,8 +254,8 @@ describe('Agent', () => { transcript: transcript, }) const auth = await client.request('extensionConfiguration/status', null) - expect(auth?.authenticated).toBeTruthy() - if (!auth?.authenticated) { + expect(auth?.status).toEqual('authenticated') + if (auth?.status !== 'authenticated') { throw new Error('unreachable') } @@ -324,7 +324,7 @@ describe('Agent', () => { // The history we are importing contains two transcripts from the same user and one from a different user. // when we do an export, we should only get the transcript from the currently logged in user const history: Record> = { - [`${auth?.endpoint}-${auth?.username}`]: { + [`${auth.endpoint}-${auth.username}`]: { [transcript1.id]: transcript1, [transcript2.id]: transcript2, }, @@ -681,11 +681,11 @@ describe('Agent', () => { beforeAll(async () => { const serverInfo = await rateLimitedClient.initialize() - expect(serverInfo.authStatus?.authenticated).toBeTruthy() - if (!serverInfo.authStatus?.authenticated) { + expect(serverInfo.authStatus?.status).toEqual('authenticated') + if (serverInfo.authStatus?.status !== 'authenticated') { throw new Error('unreachable') } - expect(serverInfo.authStatus?.username).toStrictEqual('sourcegraphcodyclients-1-efapb') + expect(serverInfo.authStatus.username).toStrictEqual('sourcegraphcodyclients-1-efapb') }, 10_000) // Skipped because Polly is failing to record the HTTP rate-limit error diff --git a/vscode/src/jsonrpc/agent-protocol.ts b/vscode/src/jsonrpc/agent-protocol.ts index 63681e3a5651..5e16a8812446 100644 --- a/vscode/src/jsonrpc/agent-protocol.ts +++ b/vscode/src/jsonrpc/agent-protocol.ts @@ -1,7 +1,6 @@ import type * as vscode from 'vscode' import type { - AuthStatus, BillingCategory, BillingProduct, CodyCommand, @@ -246,10 +245,10 @@ export type ClientRequests = { // authentication status, which indicates whether the provided credentials are // valid or not. The agent can't support autocomplete or chat if the credentials // are invalid. - 'extensionConfiguration/change': [ExtensionConfiguration, AuthStatus | null] + 'extensionConfiguration/change': [ExtensionConfiguration, ProtocolAuthStatus | null] // Returns the current authentication status without making changes to it. - 'extensionConfiguration/status': [null, AuthStatus | null] + 'extensionConfiguration/status': [null, ProtocolAuthStatus | null] // Returns the json schema of the extension confi 'extensionConfiguration/getSettingsSchema': [null, string] @@ -628,7 +627,7 @@ export interface WebviewNativeConfig { export interface ServerInfo { name: string authenticated?: boolean | undefined | null - authStatus?: AuthStatus | undefined | null + authStatus?: ProtocolAuthStatus | undefined | null } export interface ExtensionConfiguration { @@ -738,6 +737,53 @@ export interface Range { end: Position } +// Equivalent to our internal `AuthStatus` type but using a string discriminator +// instead of a boolean discriminator. Boolean discriminators complicate +// deserializing in other languages. We have custom codegen for string +// discriminators but not boolean ones. +// It's good practice to be more intentional about the Agent protocol types +// anyways. As a rule of thumb, we should try to avoid leaking internal types +// that are constantly making tiny changes that are irrelevant for the other +// clients anyways. +export type ProtocolAuthStatus = ProtocolAuthenticatedAuthStatus | ProtocolUnauthenticatedAuthStatus + +export interface ProtocolAuthenticatedAuthStatus { + status: 'authenticated' + authenticated: boolean + endpoint: string + + username: string + + /** + * Used to enable Fireworks tracing for Sourcegraph teammates on DotCom. + * https://readme.fireworks.ai/docs/enabling-tracing + */ + isFireworksTracingEnabled?: boolean + + hasVerifiedEmail?: boolean + requiresVerifiedEmail?: boolean + + primaryEmail?: string + displayName?: string + avatarURL?: string + + pendingValidation: boolean + + /** + * Organizations on the instance that the user is a member of. + */ + organizations?: { name: string; id: string }[] +} + +export interface ProtocolUnauthenticatedAuthStatus { + status: 'unauthenticated' + authenticated: boolean + endpoint: string + showNetworkError?: boolean + showInvalidAccessTokenError?: boolean + pendingValidation: boolean +} + export interface ProtocolTextDocument { // Use TextDocumentWithUri.fromDocument(TextDocument) if you want to parse this `uri` property. uri: string From 758e64b3e3e81bd4095b72b0f735ebef8d98a935 Mon Sep 17 00:00:00 2001 From: jamesmcnamara Date: Thu, 10 Oct 2024 11:45:34 -0700 Subject: [PATCH 09/10] removed auth status hack --- .../protocol_generated/CodyAgentServer.kt | 4 +- .../agent/protocol_generated/Constants.kt | 2 + .../{AuthStatus.kt => ProtocolAuthStatus.kt} | 44 ++++++++++++------- .../ProtocolTypeAdapters.kt | 2 +- .../agent/protocol_generated/ServerInfo.kt | 2 +- agent/src/cli/scip-codegen/Codegen.ts | 15 +------ 6 files changed, 36 insertions(+), 33 deletions(-) rename agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/{AuthStatus.kt => ProtocolAuthStatus.kt} (51%) diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/CodyAgentServer.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/CodyAgentServer.kt index ae225c5f1695..ac8dfb8710a5 100644 --- a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/CodyAgentServer.kt +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/CodyAgentServer.kt @@ -123,9 +123,9 @@ interface CodyAgentServer { @JsonRequest("testing/autocomplete/providerConfig") fun testing_autocomplete_providerConfig(params: Null?): CompletableFuture @JsonRequest("extensionConfiguration/change") - fun extensionConfiguration_change(params: ExtensionConfiguration): CompletableFuture + fun extensionConfiguration_change(params: ExtensionConfiguration): CompletableFuture @JsonRequest("extensionConfiguration/status") - fun extensionConfiguration_status(params: Null?): CompletableFuture + fun extensionConfiguration_status(params: Null?): CompletableFuture @JsonRequest("extensionConfiguration/getSettingsSchema") fun extensionConfiguration_getSettingsSchema(params: Null?): CompletableFuture @JsonRequest("textDocument/change") diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/Constants.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/Constants.kt index c907b6490d17..94da7f958133 100644 --- a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/Constants.kt +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/Constants.kt @@ -16,6 +16,7 @@ object Constants { const val agentic = "agentic" const val ask = "ask" const val assistant = "assistant" + const val authenticated = "authenticated" const val autocomplete = "autocomplete" const val balanced = "balanced" const val byok = "byok" @@ -83,6 +84,7 @@ object Constants { const val terminal = "terminal" const val tree = "tree" const val `tree-sitter` = "tree-sitter" + const val unauthenticated = "unauthenticated" const val unified = "unified" const val use = "use" const val user = "user" diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/AuthStatus.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/ProtocolAuthStatus.kt similarity index 51% rename from agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/AuthStatus.kt rename to agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/ProtocolAuthStatus.kt index 41821594f443..2baeee0e0917 100644 --- a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/AuthStatus.kt +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/ProtocolAuthStatus.kt @@ -1,35 +1,30 @@ @file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport") package com.sourcegraph.cody.agent.protocol_generated; +import com.google.gson.annotations.SerializedName; import com.google.gson.Gson; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import java.lang.reflect.Type; -sealed class AuthStatus { +sealed class ProtocolAuthStatus { companion object { - val deserializer: JsonDeserializer = + val deserializer: JsonDeserializer = JsonDeserializer { element: JsonElement, _: Type, context: JsonDeserializationContext -> - when (element.getAsJsonObject().get("authenticated").getAsBoolean()) { - false -> context.deserialize(element, UnauthenticatedAuthStatus::class.java) - true -> context.deserialize(element, AuthenticatedAuthStatus::class.java) + when (element.getAsJsonObject().get("status").getAsString()) { + "authenticated" -> context.deserialize(element, ProtocolAuthenticatedAuthStatus::class.java) + "unauthenticated" -> context.deserialize(element, ProtocolUnauthenticatedAuthStatus::class.java) + else -> throw Exception("Unknown discriminator ${element}") } } } } -data class UnauthenticatedAuthStatus( - val endpoint: String, +data class ProtocolAuthenticatedAuthStatus( + val status: StatusEnum, // Oneof: authenticated val authenticated: Boolean, - val showNetworkError: Boolean? = null, - val showInvalidAccessTokenError: Boolean? = null, - val pendingValidation: Boolean, -) : AuthStatus() - -data class AuthenticatedAuthStatus( val endpoint: String, - val authenticated: Boolean, val username: String, val isFireworksTracingEnabled: Boolean? = null, val hasVerifiedEmail: Boolean? = null, @@ -39,5 +34,24 @@ data class AuthenticatedAuthStatus( val avatarURL: String? = null, val pendingValidation: Boolean, val organizations: List? = null, -) : AuthStatus() +) : ProtocolAuthStatus() { + + enum class StatusEnum { + @SerializedName("authenticated") Authenticated, + } +} + +data class ProtocolUnauthenticatedAuthStatus( + val status: StatusEnum, // Oneof: unauthenticated + val authenticated: Boolean, + val endpoint: String, + val showNetworkError: Boolean? = null, + val showInvalidAccessTokenError: Boolean? = null, + val pendingValidation: Boolean, +) : ProtocolAuthStatus() { + + enum class StatusEnum { + @SerializedName("unauthenticated") Unauthenticated, + } +} diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/ProtocolTypeAdapters.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/ProtocolTypeAdapters.kt index 8dd4606f0666..f3b58496f040 100644 --- a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/ProtocolTypeAdapters.kt +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/ProtocolTypeAdapters.kt @@ -3,9 +3,9 @@ package com.sourcegraph.cody.agent.protocol_generated; object ProtocolTypeAdapters { fun register(gson: com.google.gson.GsonBuilder) { - gson.registerTypeAdapter(AuthStatus::class.java, AuthStatus.deserializer) gson.registerTypeAdapter(ContextItem::class.java, ContextItem.deserializer) gson.registerTypeAdapter(CustomCommandResult::class.java, CustomCommandResult.deserializer) + gson.registerTypeAdapter(ProtocolAuthStatus::class.java, ProtocolAuthStatus.deserializer) gson.registerTypeAdapter(TextEdit::class.java, TextEdit.deserializer) gson.registerTypeAdapter(WorkspaceEditOperation::class.java, WorkspaceEditOperation.deserializer) } diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/ServerInfo.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/ServerInfo.kt index 177c0a4c25dd..2551dc9c3220 100644 --- a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/ServerInfo.kt +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/ServerInfo.kt @@ -4,6 +4,6 @@ package com.sourcegraph.cody.agent.protocol_generated; data class ServerInfo( val name: String, val authenticated: Boolean? = null, - val authStatus: AuthStatus? = null, + val authStatus: ProtocolAuthStatus? = null, ) diff --git a/agent/src/cli/scip-codegen/Codegen.ts b/agent/src/cli/scip-codegen/Codegen.ts index ee1c1904ab35..e6ffafb882e3 100644 --- a/agent/src/cli/scip-codegen/Codegen.ts +++ b/agent/src/cli/scip-codegen/Codegen.ts @@ -549,22 +549,9 @@ export class Codegen extends BaseCodegen { if (!type.has_union_type || type.union_type.types.length === 0) { return undefined } - const unionTypes = this.unionTypes(type) - // HACK: We have to special case the `AuthStatus` type because it's - // SCIP doesn't recognize the `authenticated` member as a constant type - // and thus picks the wrong discriminator - if (info.display_name === 'AuthStatus') { - return { - symbol: info.symbol, - discriminatorDisplayName: 'authenticated', - members: unionTypes.map(type => ({ - type, - value: type.type_ref.symbol.includes('Authenticated'), - })), - } - } const candidates = new Map() const memberss = new Map() + const unionTypes = this.unionTypes(type) for (const unionType of unionTypes) { for (const propertySymbol of this.properties(unionType)) { const property = this.symtab.info(propertySymbol) From c67695d7fe0bc05187787e7ebcf619fdc8f3a60e Mon Sep 17 00:00:00 2001 From: jamesmcnamara Date: Thu, 10 Oct 2024 12:01:21 -0700 Subject: [PATCH 10/10] fixed failing tests --- agent/src/currentProtocolAuthStatus.ts | 8 ++++++-- vscode/src/jsonrpc/agent-protocol.ts | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/agent/src/currentProtocolAuthStatus.ts b/agent/src/currentProtocolAuthStatus.ts index b83624d838df..6743c1c1e1c7 100644 --- a/agent/src/currentProtocolAuthStatus.ts +++ b/agent/src/currentProtocolAuthStatus.ts @@ -1,4 +1,8 @@ -import { type AuthStatus, currentAuthStatus } from '@sourcegraph/cody-shared' +import { + type AuthStatus, + currentAuthStatus, + currentAuthStatusOrNotReadyYet, +} from '@sourcegraph/cody-shared' import type { ProtocolAuthStatus } from './protocol-alias' export function toProtocolAuthStatus(status: AuthStatus): ProtocolAuthStatus { @@ -19,7 +23,7 @@ export function currentProtocolAuthStatus(): ProtocolAuthStatus { } export function currentProtocolAuthStatusOrNotReadyYet(): ProtocolAuthStatus | undefined { - const status = currentAuthStatus() + const status = currentAuthStatusOrNotReadyYet() if (status) { return toProtocolAuthStatus(status) } diff --git a/vscode/src/jsonrpc/agent-protocol.ts b/vscode/src/jsonrpc/agent-protocol.ts index 5e16a8812446..ab3f72946016 100644 --- a/vscode/src/jsonrpc/agent-protocol.ts +++ b/vscode/src/jsonrpc/agent-protocol.ts @@ -758,29 +758,29 @@ export interface ProtocolAuthenticatedAuthStatus { * Used to enable Fireworks tracing for Sourcegraph teammates on DotCom. * https://readme.fireworks.ai/docs/enabling-tracing */ - isFireworksTracingEnabled?: boolean + isFireworksTracingEnabled?: boolean | null | undefined + hasVerifiedEmail?: boolean | null | undefined + requiresVerifiedEmail?: boolean | null | undefined - hasVerifiedEmail?: boolean - requiresVerifiedEmail?: boolean - - primaryEmail?: string - displayName?: string - avatarURL?: string + primaryEmail?: string | null | undefined + displayName?: string | null | undefined + avatarURL?: string | null | undefined pendingValidation: boolean /** * Organizations on the instance that the user is a member of. */ - organizations?: { name: string; id: string }[] + organizations?: { name: string; id: string }[] | null | undefined } export interface ProtocolUnauthenticatedAuthStatus { status: 'unauthenticated' authenticated: boolean endpoint: string - showNetworkError?: boolean - showInvalidAccessTokenError?: boolean + showNetworkError?: boolean | null | undefined + + showInvalidAccessTokenError?: boolean | null | undefined pendingValidation: boolean }