Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 150 additions & 0 deletions dotnet/src/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,34 @@ public enum ConnectionState

public class CopilotClientOptions
{
/// <summary>
/// Initializes a new instance of the <see cref="CopilotClientOptions"/> class.
/// </summary>
public CopilotClientOptions() { }

/// <summary>
/// Initializes a new instance of the <see cref="CopilotClientOptions"/> class
/// by copying the properties of the specified instance.
/// </summary>
protected CopilotClientOptions(CopilotClientOptions? other)
{
if (other is null) return;

AutoRestart = other.AutoRestart;
AutoStart = other.AutoStart;
CliArgs = (string[]?)other.CliArgs?.Clone();
CliPath = other.CliPath;
CliUrl = other.CliUrl;
Cwd = other.Cwd;
Environment = other.Environment is not null ? new Dictionary<string, string>(other.Environment) : null;
Comment thread
stephentoub marked this conversation as resolved.
Outdated
GithubToken = other.GithubToken;
Logger = other.Logger;
LogLevel = other.LogLevel;
Port = other.Port;
UseLoggedInUser = other.UseLoggedInUser;
UseStdio = other.UseStdio;
}

/// <summary>
/// Path to the Copilot CLI executable. If not specified, uses the bundled CLI from the SDK.
/// </summary>
Expand Down Expand Up @@ -53,6 +81,15 @@ public class CopilotClientOptions
/// Default: true (but defaults to false when GithubToken is provided).
/// </summary>
public bool? UseLoggedInUser { get; set; }

/// <summary>
/// Creates a shallow clone of this <see cref="CopilotClientOptions"/> instance.
/// </summary>
/// <remarks>
/// Collection properties are copied into new collections so that modifications
/// to the clone do not affect the original.
/// </remarks>
public virtual CopilotClientOptions Clone() => new(this);
Comment thread
stephentoub marked this conversation as resolved.
}

public class ToolBinaryResult
Expand Down Expand Up @@ -692,6 +729,40 @@ public class InfiniteSessionConfig

public class SessionConfig
{
/// <summary>
/// Initializes a new instance of the <see cref="SessionConfig"/> class.
/// </summary>
public SessionConfig() { }

/// <summary>
/// Initializes a new instance of the <see cref="SessionConfig"/> class
/// by copying the properties of the specified instance.
/// </summary>
protected SessionConfig(SessionConfig? other)
{
if (other is null) return;

AvailableTools = other.AvailableTools is not null ? [.. other.AvailableTools] : null;
ConfigDir = other.ConfigDir;
CustomAgents = other.CustomAgents is not null ? [.. other.CustomAgents] : null;
DisabledSkills = other.DisabledSkills is not null ? [.. other.DisabledSkills] : null;
ExcludedTools = other.ExcludedTools is not null ? [.. other.ExcludedTools] : null;
Hooks = other.Hooks;
InfiniteSessions = other.InfiniteSessions;
McpServers = other.McpServers is not null ? new Dictionary<string, object>(other.McpServers) : null;
Comment thread
stephentoub marked this conversation as resolved.
Outdated
Model = other.Model;
OnPermissionRequest = other.OnPermissionRequest;
OnUserInputRequest = other.OnUserInputRequest;
Provider = other.Provider;
ReasoningEffort = other.ReasoningEffort;
SessionId = other.SessionId;
SkillDirectories = other.SkillDirectories is not null ? [.. other.SkillDirectories] : null;
Streaming = other.Streaming;
SystemMessage = other.SystemMessage;
Tools = other.Tools is not null ? [.. other.Tools] : null;
WorkingDirectory = other.WorkingDirectory;
}

public string? SessionId { get; set; }
public string? Model { get; set; }

Expand Down Expand Up @@ -769,10 +840,53 @@ public class SessionConfig
/// When enabled (default), sessions automatically manage context limits and persist state.
/// </summary>
public InfiniteSessionConfig? InfiniteSessions { get; set; }

/// <summary>
/// Creates a shallow clone of this <see cref="SessionConfig"/> instance.
/// </summary>
/// <remarks>
/// Collection properties are copied into new collections so that modifications
/// to the clone do not affect the original.
Comment thread
stephentoub marked this conversation as resolved.
Outdated
/// </remarks>
public virtual SessionConfig Clone() => new(this);
}

public class ResumeSessionConfig
{
/// <summary>
/// Initializes a new instance of the <see cref="ResumeSessionConfig"/> class.
/// </summary>
public ResumeSessionConfig() { }

/// <summary>
/// Initializes a new instance of the <see cref="ResumeSessionConfig"/> class
/// by copying the properties of the specified instance.
/// </summary>
protected ResumeSessionConfig(ResumeSessionConfig? other)
{
if (other is null) return;

AvailableTools = other.AvailableTools is not null ? [.. other.AvailableTools] : null;
ConfigDir = other.ConfigDir;
CustomAgents = other.CustomAgents is not null ? [.. other.CustomAgents] : null;
DisabledSkills = other.DisabledSkills is not null ? [.. other.DisabledSkills] : null;
DisableResume = other.DisableResume;
ExcludedTools = other.ExcludedTools is not null ? [.. other.ExcludedTools] : null;
Hooks = other.Hooks;
InfiniteSessions = other.InfiniteSessions;
McpServers = other.McpServers is not null ? new Dictionary<string, object>(other.McpServers) : null;
Model = other.Model;
OnPermissionRequest = other.OnPermissionRequest;
OnUserInputRequest = other.OnUserInputRequest;
Provider = other.Provider;
ReasoningEffort = other.ReasoningEffort;
SkillDirectories = other.SkillDirectories is not null ? [.. other.SkillDirectories] : null;
Streaming = other.Streaming;
SystemMessage = other.SystemMessage;
Tools = other.Tools is not null ? [.. other.Tools] : null;
WorkingDirectory = other.WorkingDirectory;
}

/// <summary>
/// Model to use for this session. Can change the model when resuming.
/// </summary>
Expand Down Expand Up @@ -870,13 +984,49 @@ public class ResumeSessionConfig
/// Infinite session configuration for persistent workspaces and automatic compaction.
/// </summary>
public InfiniteSessionConfig? InfiniteSessions { get; set; }

/// <summary>
/// Creates a shallow clone of this <see cref="ResumeSessionConfig"/> instance.
/// </summary>
/// <remarks>
/// Collection properties are copied into new collections so that modifications
/// to the clone do not affect the original.
/// </remarks>
public virtual ResumeSessionConfig Clone() => new(this);
}

public class MessageOptions
{
/// <summary>
/// Initializes a new instance of the <see cref="MessageOptions"/> class.
/// </summary>
public MessageOptions() { }

/// <summary>
/// Initializes a new instance of the <see cref="MessageOptions"/> class
/// by copying the properties of the specified instance.
/// </summary>
protected MessageOptions(MessageOptions? other)
{
if (other is null) return;

Attachments = other.Attachments is not null ? [.. other.Attachments] : null;
Mode = other.Mode;
Prompt = other.Prompt;
}

public string Prompt { get; set; } = string.Empty;
public List<UserMessageDataAttachmentsItem>? Attachments { get; set; }
public string? Mode { get; set; }

/// <summary>
/// Creates a shallow clone of this <see cref="MessageOptions"/> instance.
/// </summary>
/// <remarks>
/// Collection properties are copied into new collections so that modifications
/// to the clone do not affect the original.
/// </remarks>
public virtual MessageOptions Clone() => new(this);
}

public delegate void SessionEventHandler(SessionEvent sessionEvent);
Expand Down
Loading