Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions dotnet/src/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ public async Task<CopilotSession> CreateSessionAsync(SessionConfig config, Cance
hasHooks ? true : null,
config.WorkingDirectory,
config.Streaming is true ? true : null,
config.IncludeSubAgentStreamingEvents,
config.McpServers,
"direct",
config.CustomAgents,
Expand Down Expand Up @@ -622,6 +623,7 @@ public async Task<CopilotSession> ResumeSessionAsync(string sessionId, ResumeSes
config.EnableConfigDiscovery,
config.DisableResume is true ? true : null,
config.Streaming is true ? true : null,
config.IncludeSubAgentStreamingEvents,
config.McpServers,
"direct",
config.CustomAgents,
Expand Down Expand Up @@ -1636,6 +1638,7 @@ internal record CreateSessionRequest(
bool? Hooks,
string? WorkingDirectory,
bool? Streaming,
bool? IncludeSubAgentStreamingEvents,
IDictionary<string, McpServerConfig>? McpServers,
string? EnvValueMode,
IList<CustomAgentConfig>? CustomAgents,
Expand Down Expand Up @@ -1691,6 +1694,7 @@ internal record ResumeSessionRequest(
bool? EnableConfigDiscovery,
bool? DisableResume,
bool? Streaming,
bool? IncludeSubAgentStreamingEvents,
IDictionary<string, McpServerConfig>? McpServers,
string? EnvValueMode,
IList<CustomAgentConfig>? CustomAgents,
Expand Down
24 changes: 24 additions & 0 deletions dotnet/src/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,7 @@ protected SessionConfig(SessionConfig? other)
SessionId = other.SessionId;
SkillDirectories = other.SkillDirectories is not null ? [.. other.SkillDirectories] : null;
Streaming = other.Streaming;
IncludeSubAgentStreamingEvents = other.IncludeSubAgentStreamingEvents;
SystemMessage = other.SystemMessage;
Tools = other.Tools is not null ? [.. other.Tools] : null;
WorkingDirectory = other.WorkingDirectory;
Expand Down Expand Up @@ -1848,6 +1849,17 @@ protected SessionConfig(SessionConfig? other)
/// </summary>
public bool Streaming { get; set; }

/// <summary>
/// Include sub-agent streaming events in the event stream. When true, streaming
/// delta events from sub-agents (e.g., <c>assistant.message_delta</c>,
/// <c>assistant.reasoning_delta</c>, <c>assistant.streaming_delta</c> with
/// <c>agentId</c> set) are forwarded to this connection. When false, only
/// non-streaming sub-agent events and <c>subagent.*</c> lifecycle events are
/// forwarded; streaming deltas from sub-agents are suppressed.
/// Default: true.
/// </summary>
public bool IncludeSubAgentStreamingEvents { get; set; } = true;

Comment thread
stephentoub marked this conversation as resolved.
/// <summary>
/// MCP server configurations for the session.
/// Keys are server names, values are server configurations (<see cref="McpStdioServerConfig"/> or <see cref="McpHttpServerConfig"/>).
Expand Down Expand Up @@ -1961,6 +1973,7 @@ protected ResumeSessionConfig(ResumeSessionConfig? other)
CreateSessionFsHandler = other.CreateSessionFsHandler;
SkillDirectories = other.SkillDirectories is not null ? [.. other.SkillDirectories] : null;
Streaming = other.Streaming;
IncludeSubAgentStreamingEvents = other.IncludeSubAgentStreamingEvents;
SystemMessage = other.SystemMessage;
Tools = other.Tools is not null ? [.. other.Tools] : null;
WorkingDirectory = other.WorkingDirectory;
Expand Down Expand Up @@ -2082,6 +2095,17 @@ protected ResumeSessionConfig(ResumeSessionConfig? other)
/// </summary>
public bool Streaming { get; set; }

/// <summary>
/// Include sub-agent streaming events in the event stream. When true, streaming
/// delta events from sub-agents (e.g., <c>assistant.message_delta</c>,
/// <c>assistant.reasoning_delta</c>, <c>assistant.streaming_delta</c> with
/// <c>agentId</c> set) are forwarded to this connection. When false, only
/// non-streaming sub-agent events and <c>subagent.*</c> lifecycle events are
/// forwarded; streaming deltas from sub-agents are suppressed.
/// Default: true.
/// </summary>
public bool IncludeSubAgentStreamingEvents { get; set; } = true;

Comment thread
stephentoub marked this conversation as resolved.
/// <summary>
/// MCP server configurations for the session.
/// Keys are server names, values are server configurations (<see cref="McpStdioServerConfig"/> or <see cref="McpHttpServerConfig"/>).
Expand Down
10 changes: 10 additions & 0 deletions go/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,11 @@ func (c *Client) CreateSession(ctx context.Context, config *SessionConfig) (*Ses
if config.Streaming {
req.Streaming = Bool(true)
}
if config.IncludeSubAgentStreamingEvents != nil {
req.IncludeSubAgentStreamingEvents = config.IncludeSubAgentStreamingEvents
} else {
req.IncludeSubAgentStreamingEvents = Bool(true)
}
Comment thread
stephentoub marked this conversation as resolved.
if config.OnUserInputRequest != nil {
req.RequestUserInput = Bool(true)
}
Expand Down Expand Up @@ -744,6 +749,11 @@ func (c *Client) ResumeSessionWithOptions(ctx context.Context, sessionID string,
if config.Streaming {
req.Streaming = Bool(true)
}
if config.IncludeSubAgentStreamingEvents != nil {
req.IncludeSubAgentStreamingEvents = config.IncludeSubAgentStreamingEvents
} else {
req.IncludeSubAgentStreamingEvents = Bool(true)
}
Comment thread
stephentoub marked this conversation as resolved.
if config.OnUserInputRequest != nil {
req.RequestUserInput = Bool(true)
}
Expand Down
130 changes: 73 additions & 57 deletions go/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,13 @@ type SessionConfig struct {
// When true, assistant.message_delta and assistant.reasoning_delta events
// with deltaContent are sent as the response is generated.
Streaming bool
// IncludeSubAgentStreamingEvents includes sub-agent streaming events in the
// event stream. When true, streaming delta events from sub-agents (e.g.,
// assistant.message_delta, assistant.reasoning_delta, assistant.streaming_delta
// with agentId set) are forwarded to this connection. When false, only
// non-streaming sub-agent events and subagent.* lifecycle events are forwarded;
// streaming deltas from sub-agents are suppressed. When nil, defaults to true.
IncludeSubAgentStreamingEvents *bool
// Provider configures a custom model provider (BYOK)
Provider *ProviderConfig
// ModelCapabilities overrides individual model capabilities resolved by the runtime.
Expand Down Expand Up @@ -740,6 +747,13 @@ type ResumeSessionConfig struct {
// When true, assistant.message_delta and assistant.reasoning_delta events
// with deltaContent are sent as the response is generated.
Streaming bool
// IncludeSubAgentStreamingEvents includes sub-agent streaming events in the
// event stream. When true, streaming delta events from sub-agents (e.g.,
// assistant.message_delta, assistant.reasoning_delta, assistant.streaming_delta
// with agentId set) are forwarded to this connection. When false, only
// non-streaming sub-agent events and subagent.* lifecycle events are forwarded;
// streaming deltas from sub-agents are suppressed. When nil, defaults to true.
IncludeSubAgentStreamingEvents *bool
// MCPServers configures MCP servers for the session
MCPServers map[string]MCPServerConfig
// CustomAgents configures custom agents for the session
Expand Down Expand Up @@ -937,34 +951,35 @@ type SessionLifecycleHandler func(event SessionLifecycleEvent)

// createSessionRequest is the request for session.create
type createSessionRequest struct {
Model string `json:"model,omitempty"`
SessionID string `json:"sessionId,omitempty"`
ClientName string `json:"clientName,omitempty"`
ReasoningEffort string `json:"reasoningEffort,omitempty"`
Tools []Tool `json:"tools,omitempty"`
SystemMessage *SystemMessageConfig `json:"systemMessage,omitempty"`
AvailableTools []string `json:"availableTools"`
ExcludedTools []string `json:"excludedTools,omitempty"`
Provider *ProviderConfig `json:"provider,omitempty"`
ModelCapabilities *rpc.ModelCapabilitiesOverride `json:"modelCapabilities,omitempty"`
RequestPermission *bool `json:"requestPermission,omitempty"`
RequestUserInput *bool `json:"requestUserInput,omitempty"`
Hooks *bool `json:"hooks,omitempty"`
WorkingDirectory string `json:"workingDirectory,omitempty"`
Streaming *bool `json:"streaming,omitempty"`
MCPServers map[string]MCPServerConfig `json:"mcpServers,omitempty"`
EnvValueMode string `json:"envValueMode,omitempty"`
CustomAgents []CustomAgentConfig `json:"customAgents,omitempty"`
Agent string `json:"agent,omitempty"`
ConfigDir string `json:"configDir,omitempty"`
EnableConfigDiscovery *bool `json:"enableConfigDiscovery,omitempty"`
SkillDirectories []string `json:"skillDirectories,omitempty"`
DisabledSkills []string `json:"disabledSkills,omitempty"`
InfiniteSessions *InfiniteSessionConfig `json:"infiniteSessions,omitempty"`
Commands []wireCommand `json:"commands,omitempty"`
RequestElicitation *bool `json:"requestElicitation,omitempty"`
Traceparent string `json:"traceparent,omitempty"`
Tracestate string `json:"tracestate,omitempty"`
Model string `json:"model,omitempty"`
SessionID string `json:"sessionId,omitempty"`
ClientName string `json:"clientName,omitempty"`
ReasoningEffort string `json:"reasoningEffort,omitempty"`
Tools []Tool `json:"tools,omitempty"`
SystemMessage *SystemMessageConfig `json:"systemMessage,omitempty"`
AvailableTools []string `json:"availableTools"`
ExcludedTools []string `json:"excludedTools,omitempty"`
Provider *ProviderConfig `json:"provider,omitempty"`
ModelCapabilities *rpc.ModelCapabilitiesOverride `json:"modelCapabilities,omitempty"`
RequestPermission *bool `json:"requestPermission,omitempty"`
RequestUserInput *bool `json:"requestUserInput,omitempty"`
Hooks *bool `json:"hooks,omitempty"`
WorkingDirectory string `json:"workingDirectory,omitempty"`
Streaming *bool `json:"streaming,omitempty"`
IncludeSubAgentStreamingEvents *bool `json:"includeSubAgentStreamingEvents,omitempty"`
MCPServers map[string]MCPServerConfig `json:"mcpServers,omitempty"`
EnvValueMode string `json:"envValueMode,omitempty"`
CustomAgents []CustomAgentConfig `json:"customAgents,omitempty"`
Agent string `json:"agent,omitempty"`
ConfigDir string `json:"configDir,omitempty"`
EnableConfigDiscovery *bool `json:"enableConfigDiscovery,omitempty"`
SkillDirectories []string `json:"skillDirectories,omitempty"`
DisabledSkills []string `json:"disabledSkills,omitempty"`
InfiniteSessions *InfiniteSessionConfig `json:"infiniteSessions,omitempty"`
Commands []wireCommand `json:"commands,omitempty"`
RequestElicitation *bool `json:"requestElicitation,omitempty"`
Traceparent string `json:"traceparent,omitempty"`
Tracestate string `json:"tracestate,omitempty"`
}

// wireCommand is the wire representation of a command (name + description only, no handler).
Expand All @@ -982,35 +997,36 @@ type createSessionResponse struct {

// resumeSessionRequest is the request for session.resume
type resumeSessionRequest struct {
SessionID string `json:"sessionId"`
ClientName string `json:"clientName,omitempty"`
Model string `json:"model,omitempty"`
ReasoningEffort string `json:"reasoningEffort,omitempty"`
Tools []Tool `json:"tools,omitempty"`
SystemMessage *SystemMessageConfig `json:"systemMessage,omitempty"`
AvailableTools []string `json:"availableTools"`
ExcludedTools []string `json:"excludedTools,omitempty"`
Provider *ProviderConfig `json:"provider,omitempty"`
ModelCapabilities *rpc.ModelCapabilitiesOverride `json:"modelCapabilities,omitempty"`
RequestPermission *bool `json:"requestPermission,omitempty"`
RequestUserInput *bool `json:"requestUserInput,omitempty"`
Hooks *bool `json:"hooks,omitempty"`
WorkingDirectory string `json:"workingDirectory,omitempty"`
ConfigDir string `json:"configDir,omitempty"`
EnableConfigDiscovery *bool `json:"enableConfigDiscovery,omitempty"`
DisableResume *bool `json:"disableResume,omitempty"`
Streaming *bool `json:"streaming,omitempty"`
MCPServers map[string]MCPServerConfig `json:"mcpServers,omitempty"`
EnvValueMode string `json:"envValueMode,omitempty"`
CustomAgents []CustomAgentConfig `json:"customAgents,omitempty"`
Agent string `json:"agent,omitempty"`
SkillDirectories []string `json:"skillDirectories,omitempty"`
DisabledSkills []string `json:"disabledSkills,omitempty"`
InfiniteSessions *InfiniteSessionConfig `json:"infiniteSessions,omitempty"`
Commands []wireCommand `json:"commands,omitempty"`
RequestElicitation *bool `json:"requestElicitation,omitempty"`
Traceparent string `json:"traceparent,omitempty"`
Tracestate string `json:"tracestate,omitempty"`
SessionID string `json:"sessionId"`
ClientName string `json:"clientName,omitempty"`
Model string `json:"model,omitempty"`
ReasoningEffort string `json:"reasoningEffort,omitempty"`
Tools []Tool `json:"tools,omitempty"`
SystemMessage *SystemMessageConfig `json:"systemMessage,omitempty"`
AvailableTools []string `json:"availableTools"`
ExcludedTools []string `json:"excludedTools,omitempty"`
Provider *ProviderConfig `json:"provider,omitempty"`
ModelCapabilities *rpc.ModelCapabilitiesOverride `json:"modelCapabilities,omitempty"`
RequestPermission *bool `json:"requestPermission,omitempty"`
RequestUserInput *bool `json:"requestUserInput,omitempty"`
Hooks *bool `json:"hooks,omitempty"`
WorkingDirectory string `json:"workingDirectory,omitempty"`
ConfigDir string `json:"configDir,omitempty"`
EnableConfigDiscovery *bool `json:"enableConfigDiscovery,omitempty"`
DisableResume *bool `json:"disableResume,omitempty"`
Streaming *bool `json:"streaming,omitempty"`
IncludeSubAgentStreamingEvents *bool `json:"includeSubAgentStreamingEvents,omitempty"`
MCPServers map[string]MCPServerConfig `json:"mcpServers,omitempty"`
EnvValueMode string `json:"envValueMode,omitempty"`
CustomAgents []CustomAgentConfig `json:"customAgents,omitempty"`
Agent string `json:"agent,omitempty"`
SkillDirectories []string `json:"skillDirectories,omitempty"`
DisabledSkills []string `json:"disabledSkills,omitempty"`
InfiniteSessions *InfiniteSessionConfig `json:"infiniteSessions,omitempty"`
Commands []wireCommand `json:"commands,omitempty"`
RequestElicitation *bool `json:"requestElicitation,omitempty"`
Traceparent string `json:"traceparent,omitempty"`
Tracestate string `json:"tracestate,omitempty"`
}

// resumeSessionResponse is the response from session.resume
Expand Down
2 changes: 2 additions & 0 deletions nodejs/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ export class CopilotClient {
hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
workingDirectory: config.workingDirectory,
streaming: config.streaming,
includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
mcpServers: config.mcpServers,
Comment thread
stephentoub marked this conversation as resolved.
envValueMode: "direct",
customAgents: config.customAgents,
Expand Down Expand Up @@ -888,6 +889,7 @@ export class CopilotClient {
configDir: config.configDir,
enableConfigDiscovery: config.enableConfigDiscovery,
streaming: config.streaming,
includeSubAgentStreamingEvents: config.includeSubAgentStreamingEvents ?? true,
mcpServers: config.mcpServers,
Comment thread
stephentoub marked this conversation as resolved.
envValueMode: "direct",
customAgents: config.customAgents,
Expand Down
12 changes: 12 additions & 0 deletions nodejs/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,17 @@ export interface SessionConfig {
*/
streaming?: boolean;

/**
* Include sub-agent streaming events in the event stream. When true, streaming
* delta events from sub-agents (e.g., `assistant.message_delta`,
* `assistant.reasoning_delta`, `assistant.streaming_delta` with `agentId` set)
* are forwarded to this connection. When false, only non-streaming sub-agent
* events and `subagent.*` lifecycle events are forwarded; streaming deltas from
* sub-agents are suppressed.
* @default true
*/
includeSubAgentStreamingEvents?: boolean;

/**
* MCP server configurations for the session.
* Keys are server names, values are server configurations.
Expand Down Expand Up @@ -1338,6 +1349,7 @@ export type ResumeSessionConfig = Pick<
| "provider"
| "modelCapabilities"
| "streaming"
| "includeSubAgentStreamingEvents"
| "reasoningEffort"
| "onPermissionRequest"
| "onUserInputRequest"
Expand Down
Loading
Loading