Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions dotnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Create a new conversation session.

- `SessionId` - Custom session ID
- `Model` - Model to use ("gpt-5", "claude-sonnet-4.5", etc.)
- `ReasoningEffort` - Reasoning effort level for models that support it ("low", "medium", "high", "xhigh"). Use `ListModelsAsync()` to check which models support this option.
- `Tools` - Custom tools exposed to the CLI
- `SystemMessage` - System message customization
- `AvailableTools` - List of tool names to allow
Expand Down
4 changes: 4 additions & 0 deletions dotnet/src/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ public async Task<CopilotSession> CreateSessionAsync(SessionConfig? config = nul
var request = new CreateSessionRequest(
config?.Model,
config?.SessionId,
config?.ReasoningEffort,
config?.Tools?.Select(ToolDefinition.FromAIFunction).ToList(),
config?.SystemMessage,
config?.AvailableTools,
Expand Down Expand Up @@ -428,6 +429,7 @@ public async Task<CopilotSession> ResumeSessionAsync(string sessionId, ResumeSes

var request = new ResumeSessionRequest(
sessionId,
config?.ReasoningEffort,
config?.Tools?.Select(ToolDefinition.FromAIFunction).ToList(),
config?.Provider,
config?.OnPermissionRequest != null ? true : null,
Expand Down Expand Up @@ -1090,6 +1092,7 @@ public static string Escape(string arg)
internal record CreateSessionRequest(
string? Model,
string? SessionId,
string? ReasoningEffort,
List<ToolDefinition>? Tools,
SystemMessageConfig? SystemMessage,
List<string>? AvailableTools,
Expand Down Expand Up @@ -1122,6 +1125,7 @@ internal record CreateSessionResponse(

internal record ResumeSessionRequest(
string SessionId,
string? ReasoningEffort,
List<ToolDefinition>? Tools,
ProviderConfig? Provider,
bool? RequestPermission,
Expand Down
27 changes: 27 additions & 0 deletions dotnet/src/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,13 @@ public class SessionConfig
public string? SessionId { get; set; }
public string? Model { get; set; }

/// <summary>
/// Reasoning effort level for models that support it.
/// Valid values: "low", "medium", "high", "xhigh".
/// Only applies to models where capabilities.supports.reasoningEffort is true.
/// </summary>
public string? ReasoningEffort { get; set; }

/// <summary>
/// Override the default configuration directory location.
/// When specified, the session will use this directory for storing config and state.
Expand Down Expand Up @@ -766,6 +773,12 @@ public class ResumeSessionConfig
public ICollection<AIFunction>? Tools { get; set; }
public ProviderConfig? Provider { get; set; }

/// <summary>
/// Reasoning effort level for models that support it.
/// Valid values: "low", "medium", "high", "xhigh".
/// </summary>
public string? ReasoningEffort { get; set; }

/// <summary>
/// Handler for permission requests from the server.
/// When provided, the server will call this handler to request permission for operations.
Expand Down Expand Up @@ -930,6 +943,12 @@ public class ModelSupports
{
[JsonPropertyName("vision")]
public bool Vision { get; set; }

/// <summary>
/// Whether this model supports reasoning effort configuration.
/// </summary>
[JsonPropertyName("reasoningEffort")]
public bool ReasoningEffort { get; set; }
}

/// <summary>
Expand Down Expand Up @@ -989,6 +1008,14 @@ public class ModelInfo
/// <summary>Billing information</summary>
[JsonPropertyName("billing")]
public ModelBilling? Billing { get; set; }

/// <summary>Supported reasoning effort levels (only present if model supports reasoning effort)</summary>
[JsonPropertyName("supportedReasoningEfforts")]
public List<string>? SupportedReasoningEfforts { get; set; }

/// <summary>Default reasoning effort level (only present if model supports reasoning effort)</summary>
[JsonPropertyName("defaultReasoningEffort")]
public string? DefaultReasoningEffort { get; set; }
}

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func main() {
**SessionConfig:**

- `Model` (string): Model to use ("gpt-5", "claude-sonnet-4.5", etc.). **Required when using custom provider.**
- `ReasoningEffort` (string): Reasoning effort level for models that support it ("low", "medium", "high", "xhigh"). Use `ListModels()` to check which models support this option.
- `SessionID` (string): Custom session ID
- `Tools` ([]Tool): Custom tools exposed to the CLI
- `SystemMessage` (\*SystemMessageConfig): System message configuration
Expand All @@ -114,6 +115,7 @@ func main() {
**ResumeSessionConfig:**

- `Tools` ([]Tool): Tools to expose when resuming
- `ReasoningEffort` (string): Reasoning effort level for models that support it
- `Provider` (\*ProviderConfig): Custom API provider configuration (BYOK). See [Custom Providers](#custom-providers) section.
- `Streaming` (bool): Enable streaming delta events

Expand Down
6 changes: 6 additions & 0 deletions go/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@ func (c *Client) CreateSession(config *SessionConfig) (*Session, error) {
if config.SessionID != "" {
params["sessionId"] = config.SessionID
}
if config.ReasoningEffort != "" {
params["reasoningEffort"] = config.ReasoningEffort
}
if len(config.Tools) > 0 {
toolDefs := make([]map[string]interface{}, 0, len(config.Tools))
for _, tool := range config.Tools {
Expand Down Expand Up @@ -670,6 +673,9 @@ func (c *Client) ResumeSessionWithOptions(sessionID string, config *ResumeSessio
}

if config != nil {
if config.ReasoningEffort != "" {
params["reasoningEffort"] = config.ReasoningEffort
}
if len(config.Tools) > 0 {
toolDefs := make([]map[string]interface{}, 0, len(config.Tools))
for _, tool := range config.Tools {
Expand Down
22 changes: 16 additions & 6 deletions go/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ type SessionConfig struct {
SessionID string
// Model to use for this session
Model string
// ReasoningEffort level for models that support it.
// Valid values: "low", "medium", "high", "xhigh"
// Only applies to models where capabilities.supports.reasoningEffort is true.
ReasoningEffort string
// ConfigDir overrides the default configuration directory location.
// When specified, the session will use this directory for storing config and state.
ConfigDir string
Expand Down Expand Up @@ -399,6 +403,9 @@ type ResumeSessionConfig struct {
Tools []Tool
// Provider configures a custom model provider
Provider *ProviderConfig
// ReasoningEffort level for models that support it.
// Valid values: "low", "medium", "high", "xhigh"
ReasoningEffort string
// OnPermissionRequest is a handler for permission requests from the server
OnPermissionRequest PermissionHandler
// OnUserInputRequest is a handler for user input requests from the agent (enables ask_user tool)
Expand Down Expand Up @@ -523,7 +530,8 @@ type ModelLimits struct {

// ModelSupports contains model support flags
type ModelSupports struct {
Vision bool `json:"vision"`
Vision bool `json:"vision"`
ReasoningEffort bool `json:"reasoningEffort"`
}

// ModelCapabilities contains model capabilities and limits
Expand All @@ -545,11 +553,13 @@ type ModelBilling struct {

// ModelInfo contains information about an available model
type ModelInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Capabilities ModelCapabilities `json:"capabilities"`
Policy *ModelPolicy `json:"policy,omitempty"`
Billing *ModelBilling `json:"billing,omitempty"`
ID string `json:"id"`
Name string `json:"name"`
Capabilities ModelCapabilities `json:"capabilities"`
Policy *ModelPolicy `json:"policy,omitempty"`
Billing *ModelBilling `json:"billing,omitempty"`
SupportedReasoningEfforts []string `json:"supportedReasoningEfforts,omitempty"`
DefaultReasoningEffort string `json:"defaultReasoningEffort,omitempty"`
}

// GetModelsResponse is the response from models.list
Expand Down
17 changes: 9 additions & 8 deletions nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ Create a new conversation session.

**Config:**

- `sessionId?: string` - Custom session ID
- `sessionId?: string` - Custom session ID.
- `model?: string` - Model to use ("gpt-5", "claude-sonnet-4.5", etc.). **Required when using custom provider.**
- `reasoningEffort?: "low" | "medium" | "high" | "xhigh"` - Reasoning effort level for models that support it. Use `listModels()` to check which models support this option.
- `tools?: Tool[]` - Custom tools exposed to the CLI
- `systemMessage?: SystemMessageConfig` - System message customization (see below)
- `infiniteSessions?: InfiniteSessionConfig` - Configure automatic context compaction (see below)
Expand Down Expand Up @@ -511,12 +512,12 @@ const session = await client.createSession({
// request.question - The question to ask
// request.choices - Optional array of choices for multiple choice
// request.allowFreeform - Whether freeform input is allowed (default: true)

console.log(`Agent asks: ${request.question}`);
if (request.choices) {
console.log(`Choices: ${request.choices.join(", ")}`);
}

// Return the user's response
return {
answer: "User's answer here",
Expand Down Expand Up @@ -544,7 +545,7 @@ const session = await client.createSession({
additionalContext: "Extra context for the model",
};
},

// Called after each tool execution
onPostToolUse: async (input, invocation) => {
console.log(`Tool ${input.toolName} completed`);
Expand All @@ -553,28 +554,28 @@ const session = await client.createSession({
additionalContext: "Post-execution notes",
};
},

// Called when user submits a prompt
onUserPromptSubmitted: async (input, invocation) => {
console.log(`User prompt: ${input.prompt}`);
return {
modifiedPrompt: input.prompt, // Optionally modify the prompt
};
},

// Called when session starts
onSessionStart: async (input, invocation) => {
console.log(`Session started from: ${input.source}`); // "startup", "resume", "new"
return {
additionalContext: "Session initialization context",
};
},

// Called when session ends
onSessionEnd: async (input, invocation) => {
console.log(`Session ended: ${input.reason}`);
},

// Called when an error occurs
onErrorOccurred: async (input, invocation) => {
console.error(`Error in ${input.errorContext}: ${input.error}`);
Expand Down
56 changes: 28 additions & 28 deletions nodejs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@github/copilot": "^0.0.399",
"@github/copilot": "^0.0.400",
"vscode-jsonrpc": "^8.2.1",
"zod": "^4.3.5"
},
Expand Down
2 changes: 2 additions & 0 deletions nodejs/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ export class CopilotClient {
const response = await this.connection!.sendRequest("session.create", {
model: config.model,
sessionId: config.sessionId,
reasoningEffort: config.reasoningEffort,
tools: config.tools?.map((tool) => ({
name: tool.name,
description: tool.description,
Expand Down Expand Up @@ -531,6 +532,7 @@ export class CopilotClient {

const response = await this.connection!.sendRequest("session.resume", {
sessionId,
reasoningEffort: config.reasoningEffort,
tools: config.tools?.map((tool) => ({
name: tool.name,
description: tool.description,
Expand Down
Loading
Loading