diff --git a/dotnet/src/Generated/Rpc.cs b/dotnet/src/Generated/Rpc.cs index 9b6f60c45..fce4b4708 100644 --- a/dotnet/src/Generated/Rpc.cs +++ b/dotnet/src/Generated/Rpc.cs @@ -686,7 +686,7 @@ internal sealed class ModeSetRequest /// RPC data type for NameGet operations. public sealed class NameGetResult { - /// The session name, falling back to the auto-generated summary, or null if neither exists. + /// The session name (user-set or auto-generated), or null if not yet set. [JsonPropertyName("name")] public string? Name { get; set; } } @@ -829,6 +829,10 @@ public sealed class WorkspacesGetWorkspaceResultWorkspace /// Gets or sets the updated_at value. [JsonPropertyName("updated_at")] public DateTimeOffset? UpdatedAt { get; set; } + + /// Gets or sets the user_named value. + [JsonPropertyName("user_named")] + public bool? UserNamed { get; set; } } /// RPC data type for WorkspacesGetWorkspace operations. @@ -987,6 +991,10 @@ public sealed class AgentInfo /// Unique identifier of the custom agent. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; + + /// Absolute local file path of the agent definition. Only set for file-based agents loaded from disk; remote agents do not have a path. + [JsonPropertyName("path")] + public string? Path { get; set; } } /// RPC data type for AgentList operations. @@ -1074,6 +1082,286 @@ internal sealed class SessionAgentReloadRequest public string SessionId { get; set; } = string.Empty; } +/// RPC data type for TasksStartAgent operations. +[Experimental(Diagnostics.Experimental)] +public sealed class TasksStartAgentResult +{ + /// Generated agent ID for the background task. + [JsonPropertyName("agentId")] + public string AgentId { get; set; } = string.Empty; +} + +/// RPC data type for TasksStartAgent operations. +[Experimental(Diagnostics.Experimental)] +internal sealed class TasksStartAgentRequest +{ + /// Type of agent to start (e.g., 'explore', 'task', 'general-purpose'). + [JsonPropertyName("agentType")] + public string AgentType { get; set; } = string.Empty; + + /// Short description of the task. + [JsonPropertyName("description")] + public string? Description { get; set; } + + /// Optional model override. + [JsonPropertyName("model")] + public string? Model { get; set; } + + /// Short name for the agent, used to generate a human-readable ID. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + + /// Task prompt for the agent. + [JsonPropertyName("prompt")] + public string Prompt { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Polymorphic base type discriminated by type. +[JsonPolymorphic( + TypeDiscriminatorPropertyName = "type", + UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] +[JsonDerivedType(typeof(TaskInfoAgent), "agent")] +[JsonDerivedType(typeof(TaskInfoShell), "shell")] +public partial class TaskInfo +{ + /// The type discriminator. + [JsonPropertyName("type")] + public virtual string Type { get; set; } = string.Empty; +} + + +/// The agent variant of . +public partial class TaskInfoAgent : TaskInfo +{ + /// + [JsonIgnore] + public override string Type => "agent"; + + /// ISO 8601 timestamp when the current active period began. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("activeStartedAt")] + public DateTimeOffset? ActiveStartedAt { get; set; } + + /// Accumulated active execution time in milliseconds. + [JsonConverter(typeof(MillisecondsTimeSpanConverter))] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("activeTimeMs")] + public TimeSpan? ActiveTimeMs { get; set; } + + /// Type of agent running this task. + [JsonPropertyName("agentType")] + public required string AgentType { get; set; } + + /// Whether the task is currently in the original sync wait and can be moved to background mode. False once it is already backgrounded, idle, finished, or no longer has a promotable sync waiter. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("canPromoteToBackground")] + public bool? CanPromoteToBackground { get; set; } + + /// ISO 8601 timestamp when the task finished. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("completedAt")] + public DateTimeOffset? CompletedAt { get; set; } + + /// Short description of the task. + [JsonPropertyName("description")] + public required string Description { get; set; } + + /// Error message when the task failed. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("error")] + public string? Error { get; set; } + + /// How the agent is currently being managed by the runtime. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("executionMode")] + public TaskAgentInfoExecutionMode? ExecutionMode { get; set; } + + /// Unique task identifier. + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// ISO 8601 timestamp when the agent entered idle state. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("idleSince")] + public DateTimeOffset? IdleSince { get; set; } + + /// Most recent response text from the agent. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("latestResponse")] + public string? LatestResponse { get; set; } + + /// Model used for the task when specified. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("model")] + public string? Model { get; set; } + + /// Prompt passed to the agent. + [JsonPropertyName("prompt")] + public required string Prompt { get; set; } + + /// Result text from the task when available. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("result")] + public string? Result { get; set; } + + /// ISO 8601 timestamp when the task was started. + [JsonPropertyName("startedAt")] + public required DateTimeOffset StartedAt { get; set; } + + /// Current lifecycle status of the task. + [JsonPropertyName("status")] + public required TaskAgentInfoStatus Status { get; set; } + + /// Tool call ID associated with this agent task. + [JsonPropertyName("toolCallId")] + public required string ToolCallId { get; set; } +} + +/// The shell variant of . +public partial class TaskInfoShell : TaskInfo +{ + /// + [JsonIgnore] + public override string Type => "shell"; + + /// Whether the shell runs inside a managed PTY session or as an independent background process. + [JsonPropertyName("attachmentMode")] + public required TaskShellInfoAttachmentMode AttachmentMode { get; set; } + + /// Whether this shell task can be promoted to background mode. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("canPromoteToBackground")] + public bool? CanPromoteToBackground { get; set; } + + /// Command being executed. + [JsonPropertyName("command")] + public required string Command { get; set; } + + /// ISO 8601 timestamp when the task finished. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("completedAt")] + public DateTimeOffset? CompletedAt { get; set; } + + /// Short description of the task. + [JsonPropertyName("description")] + public required string Description { get; set; } + + /// Whether the shell command is currently sync-waited or background-managed. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("executionMode")] + public TaskShellInfoExecutionMode? ExecutionMode { get; set; } + + /// Unique task identifier. + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// Path to the detached shell log, when available. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("logPath")] + public string? LogPath { get; set; } + + /// Process ID when available. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("pid")] + public long? Pid { get; set; } + + /// ISO 8601 timestamp when the task was started. + [JsonPropertyName("startedAt")] + public required DateTimeOffset StartedAt { get; set; } + + /// Current lifecycle status of the task. + [JsonPropertyName("status")] + public required TaskShellInfoStatus Status { get; set; } +} + +/// RPC data type for TaskList operations. +[Experimental(Diagnostics.Experimental)] +public sealed class TaskList +{ + /// Currently tracked tasks. + [JsonPropertyName("tasks")] + public IList Tasks { get => field ??= []; set; } +} + +/// RPC data type for SessionTasksList operations. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionTasksListRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// RPC data type for TasksPromoteToBackground operations. +[Experimental(Diagnostics.Experimental)] +public sealed class TasksPromoteToBackgroundResult +{ + /// Whether the task was successfully promoted to background mode. + [JsonPropertyName("promoted")] + public bool Promoted { get; set; } +} + +/// RPC data type for TasksPromoteToBackground operations. +[Experimental(Diagnostics.Experimental)] +internal sealed class TasksPromoteToBackgroundRequest +{ + /// Task identifier. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// RPC data type for TasksCancel operations. +[Experimental(Diagnostics.Experimental)] +public sealed class TasksCancelResult +{ + /// Whether the task was successfully cancelled. + [JsonPropertyName("cancelled")] + public bool Cancelled { get; set; } +} + +/// RPC data type for TasksCancel operations. +[Experimental(Diagnostics.Experimental)] +internal sealed class TasksCancelRequest +{ + /// Task identifier. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// RPC data type for TasksRemove operations. +[Experimental(Diagnostics.Experimental)] +public sealed class TasksRemoveResult +{ + /// Whether the task was removed. Returns false if the task does not exist or is still running/idle (cancel it first). + [JsonPropertyName("removed")] + public bool Removed { get; set; } +} + +/// RPC data type for TasksRemove operations. +[Experimental(Diagnostics.Experimental)] +internal sealed class TasksRemoveRequest +{ + /// Task identifier. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + /// RPC data type for Skill operations. public sealed class Skill { @@ -2539,6 +2827,89 @@ public enum InstructionsSourcesType } +/// How the agent is currently being managed by the runtime. +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum TaskAgentInfoExecutionMode +{ + /// The sync variant. + [JsonStringEnumMemberName("sync")] + Sync, + /// The background variant. + [JsonStringEnumMemberName("background")] + Background, +} + + +/// Current lifecycle status of the task. +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum TaskAgentInfoStatus +{ + /// The running variant. + [JsonStringEnumMemberName("running")] + Running, + /// The idle variant. + [JsonStringEnumMemberName("idle")] + Idle, + /// The completed variant. + [JsonStringEnumMemberName("completed")] + Completed, + /// The failed variant. + [JsonStringEnumMemberName("failed")] + Failed, + /// The cancelled variant. + [JsonStringEnumMemberName("cancelled")] + Cancelled, +} + + +/// Whether the shell runs inside a managed PTY session or as an independent background process. +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum TaskShellInfoAttachmentMode +{ + /// The attached variant. + [JsonStringEnumMemberName("attached")] + Attached, + /// The detached variant. + [JsonStringEnumMemberName("detached")] + Detached, +} + + +/// Whether the shell command is currently sync-waited or background-managed. +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum TaskShellInfoExecutionMode +{ + /// The sync variant. + [JsonStringEnumMemberName("sync")] + Sync, + /// The background variant. + [JsonStringEnumMemberName("background")] + Background, +} + + +/// Current lifecycle status of the task. +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum TaskShellInfoStatus +{ + /// The running variant. + [JsonStringEnumMemberName("running")] + Running, + /// The idle variant. + [JsonStringEnumMemberName("idle")] + Idle, + /// The completed variant. + [JsonStringEnumMemberName("completed")] + Completed, + /// The failed variant. + [JsonStringEnumMemberName("failed")] + Failed, + /// The cancelled variant. + [JsonStringEnumMemberName("cancelled")] + Cancelled, +} + + /// Configuration source: user, workspace, plugin, or builtin. [JsonConverter(typeof(JsonStringEnumConverter))] public enum McpServerSource @@ -2943,6 +3314,7 @@ internal SessionRpc(JsonRpc rpc, string sessionId) Instructions = new InstructionsApi(rpc, sessionId); Fleet = new FleetApi(rpc, sessionId); Agent = new AgentApi(rpc, sessionId); + Tasks = new TasksApi(rpc, sessionId); Skills = new SkillsApi(rpc, sessionId); Mcp = new McpApi(rpc, sessionId); Plugins = new PluginsApi(rpc, sessionId); @@ -2983,6 +3355,9 @@ internal SessionRpc(JsonRpc rpc, string sessionId) /// Agent APIs. public AgentApi Agent { get; } + /// Tasks APIs. + public TasksApi Tasks { get; } + /// Skills APIs. public SkillsApi Skills { get; } @@ -3290,6 +3665,55 @@ public async Task ReloadAsync(CancellationToken cancellationT } } +/// Provides session-scoped Tasks APIs. +[Experimental(Diagnostics.Experimental)] +public sealed class TasksApi +{ + private readonly JsonRpc _rpc; + private readonly string _sessionId; + + internal TasksApi(JsonRpc rpc, string sessionId) + { + _rpc = rpc; + _sessionId = sessionId; + } + + /// Calls "session.tasks.startAgent". + public async Task StartAgentAsync(string agentType, string prompt, string name, string? description = null, string? model = null, CancellationToken cancellationToken = default) + { + var request = new TasksStartAgentRequest { SessionId = _sessionId, AgentType = agentType, Prompt = prompt, Name = name, Description = description, Model = model }; + return await CopilotClient.InvokeRpcAsync(_rpc, "session.tasks.startAgent", [request], cancellationToken); + } + + /// Calls "session.tasks.list". + public async Task ListAsync(CancellationToken cancellationToken = default) + { + var request = new SessionTasksListRequest { SessionId = _sessionId }; + return await CopilotClient.InvokeRpcAsync(_rpc, "session.tasks.list", [request], cancellationToken); + } + + /// Calls "session.tasks.promoteToBackground". + public async Task PromoteToBackgroundAsync(string id, CancellationToken cancellationToken = default) + { + var request = new TasksPromoteToBackgroundRequest { SessionId = _sessionId, Id = id }; + return await CopilotClient.InvokeRpcAsync(_rpc, "session.tasks.promoteToBackground", [request], cancellationToken); + } + + /// Calls "session.tasks.cancel". + public async Task CancelAsync(string id, CancellationToken cancellationToken = default) + { + var request = new TasksCancelRequest { SessionId = _sessionId, Id = id }; + return await CopilotClient.InvokeRpcAsync(_rpc, "session.tasks.cancel", [request], cancellationToken); + } + + /// Calls "session.tasks.remove". + public async Task RemoveAsync(string id, CancellationToken cancellationToken = default) + { + var request = new TasksRemoveRequest { SessionId = _sessionId, Id = id }; + return await CopilotClient.InvokeRpcAsync(_rpc, "session.tasks.remove", [request], cancellationToken); + } +} + /// Provides session-scoped Skills APIs. [Experimental(Diagnostics.Experimental)] public sealed class SkillsApi @@ -3905,6 +4329,7 @@ public static void RegisterClientSessionApiHandlers(JsonRpc rpc, FuncFailed LLM API call metadata for telemetry. +/// Represents the model.call_failure event. +public partial class ModelCallFailureEvent : SessionEvent +{ + /// + [JsonIgnore] + public override string Type => "model.call_failure"; + + /// The model.call_failure event payload. + [JsonPropertyName("data")] + public required ModelCallFailureData Data { get; set; } +} + /// Turn abort information including the reason for termination. /// Represents the abort event. public partial class AbortEvent : SessionEvent @@ -1213,6 +1227,16 @@ public partial class SessionRemoteSteerableChangedData /// Error details for timeline display including message and optional diagnostic information. public partial class SessionErrorData { + /// Only set on `errorType: "rate_limit"`. When `true`, the runtime will follow this error with an `auto_mode_switch.requested` event (or silently switch if `continueOnAutoMode` is enabled). UI clients can use this flag to suppress duplicate rendering of the rate-limit error when they show their own auto-mode-switch prompt. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("eligibleForAutoSwitch")] + public bool? EligibleForAutoSwitch { get; set; } + + /// Fine-grained error code from the upstream provider, when available. For `errorType: "rate_limit"`, this is one of the `RateLimitErrorCode` values (e.g., `"user_weekly_rate_limited"`, `"user_global_rate_limited"`, `"rate_limited"`, `"user_model_rate_limited"`, `"integration_rate_limited"`). + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("errorCode")] + public string? ErrorCode { get; set; } + /// Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query"). [JsonPropertyName("errorType")] public required string ErrorType { get; set; } @@ -1272,6 +1296,11 @@ public partial class SessionInfoData [JsonPropertyName("message")] public required string Message { get; set; } + /// Optional actionable tip displayed with this message. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("tip")] + public string? Tip { get; set; } + /// Optional URL associated with this message that the user can open in a browser. [Url] [StringSyntax(StringSyntaxAttribute.Uri)] @@ -1302,6 +1331,11 @@ public partial class SessionWarningData /// Model change details including previous and new model identifiers. public partial class SessionModelChangeData { + /// Reason the change happened, when not user-initiated. Currently `"rate_limit_auto_switch"` for changes triggered by the auto-mode-switch rate-limit recovery path. UI clients can use this to render contextual copy. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("cause")] + public string? Cause { get; set; } + /// Newly selected model identifier. [JsonPropertyName("newModel")] public required string NewModel { get; set; } @@ -1961,6 +1995,49 @@ public partial class AssistantUsageData public double? TtftMs { get; set; } } +/// Failed LLM API call metadata for telemetry. +public partial class ModelCallFailureData +{ + /// Completion ID from the model provider (e.g., chatcmpl-abc123). + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("apiCallId")] + public string? ApiCallId { get; set; } + + /// Duration of the failed API call in milliseconds. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("durationMs")] + public double? DurationMs { get; set; } + + /// Raw provider/runtime error message for restricted telemetry. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("errorMessage")] + public string? ErrorMessage { get; set; } + + /// What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("initiator")] + public string? Initiator { get; set; } + + /// Model identifier used for the failed API call. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("model")] + public string? Model { get; set; } + + /// GitHub request tracing ID (x-github-request-id header) for server-side log correlation. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("providerCallId")] + public string? ProviderCallId { get; set; } + + /// Where the failed model call originated. + [JsonPropertyName("source")] + public required ModelCallFailureSource Source { get; set; } + + /// HTTP status code from the failed request. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("statusCode")] + public long? StatusCode { get; set; } +} + /// Turn abort information including the reason for termination. public partial class AbortData { @@ -2607,6 +2684,11 @@ public partial class AutoModeSwitchRequestedData /// Unique identifier for this request; used to respond via session.respondToAutoModeSwitch(). [JsonPropertyName("requestId")] public required string RequestId { get; set; } + + /// Seconds until the rate limit resets, when known. Lets clients render a humanized reset time alongside the prompt. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("retryAfterSeconds")] + public double? RetryAfterSeconds { get; set; } } /// Auto mode switch completion notification. @@ -3552,7 +3634,7 @@ public partial class SystemNotificationNewInboxMessage : SystemNotification [JsonPropertyName("senderName")] public required string SenderName { get; set; } - /// Category of the sender (e.g., ambient-agent, plugin, hook). + /// Category of the sender (e.g., sidekick-agent, plugin, hook). [JsonPropertyName("senderType")] public required string SenderType { get; set; } @@ -4485,6 +4567,21 @@ public enum AssistantMessageToolRequestType Custom, } +/// Where the failed model call originated. +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum ModelCallFailureSource +{ + /// The top_level variant. + [JsonStringEnumMemberName("top_level")] + TopLevel, + /// The subagent variant. + [JsonStringEnumMemberName("subagent")] + Subagent, + /// The mcp_sampling variant. + [JsonStringEnumMemberName("mcp_sampling")] + McpSampling, +} + /// Theme variant this icon is intended for. [JsonConverter(typeof(JsonStringEnumConverter))] public enum ToolExecutionCompleteContentResourceLinkIconTheme @@ -4794,6 +4891,8 @@ public enum ExtensionsLoadedExtensionStatus [JsonSerializable(typeof(McpOauthRequiredEvent))] [JsonSerializable(typeof(McpOauthRequiredStaticClientConfig))] [JsonSerializable(typeof(McpServersLoadedServer))] +[JsonSerializable(typeof(ModelCallFailureData))] +[JsonSerializable(typeof(ModelCallFailureEvent))] [JsonSerializable(typeof(PendingMessagesModifiedData))] [JsonSerializable(typeof(PendingMessagesModifiedEvent))] [JsonSerializable(typeof(PermissionCompletedData))] diff --git a/go/generated_session_events.go b/go/generated_session_events.go index 8b393bec9..4fdc8641e 100644 --- a/go/generated_session_events.go +++ b/go/generated_session_events.go @@ -263,6 +263,12 @@ func (e *SessionEvent) UnmarshalJSON(data []byte) error { return err } e.Data = &d + case SessionEventTypeModelCallFailure: + var d ModelCallFailureData + if err := json.Unmarshal(raw.Data, &d); err != nil { + return err + } + e.Data = &d case SessionEventTypeAbort: var d AbortData if err := json.Unmarshal(raw.Data, &d); err != nil { @@ -556,82 +562,83 @@ func (e SessionEvent) MarshalJSON() ([]byte, error) { type SessionEventType string const ( - SessionEventTypeSessionStart SessionEventType = "session.start" - SessionEventTypeSessionResume SessionEventType = "session.resume" + SessionEventTypeSessionStart SessionEventType = "session.start" + SessionEventTypeSessionResume SessionEventType = "session.resume" SessionEventTypeSessionRemoteSteerableChanged SessionEventType = "session.remote_steerable_changed" - SessionEventTypeSessionError SessionEventType = "session.error" - SessionEventTypeSessionIdle SessionEventType = "session.idle" - SessionEventTypeSessionTitleChanged SessionEventType = "session.title_changed" - SessionEventTypeSessionInfo SessionEventType = "session.info" - SessionEventTypeSessionWarning SessionEventType = "session.warning" - SessionEventTypeSessionModelChange SessionEventType = "session.model_change" - SessionEventTypeSessionModeChanged SessionEventType = "session.mode_changed" - SessionEventTypeSessionPlanChanged SessionEventType = "session.plan_changed" - SessionEventTypeSessionWorkspaceFileChanged SessionEventType = "session.workspace_file_changed" - SessionEventTypeSessionHandoff SessionEventType = "session.handoff" - SessionEventTypeSessionTruncation SessionEventType = "session.truncation" - SessionEventTypeSessionSnapshotRewind SessionEventType = "session.snapshot_rewind" - SessionEventTypeSessionShutdown SessionEventType = "session.shutdown" - SessionEventTypeSessionContextChanged SessionEventType = "session.context_changed" - SessionEventTypeSessionUsageInfo SessionEventType = "session.usage_info" - SessionEventTypeSessionCompactionStart SessionEventType = "session.compaction_start" - SessionEventTypeSessionCompactionComplete SessionEventType = "session.compaction_complete" - SessionEventTypeSessionTaskComplete SessionEventType = "session.task_complete" - SessionEventTypeUserMessage SessionEventType = "user.message" - SessionEventTypePendingMessagesModified SessionEventType = "pending_messages.modified" - SessionEventTypeAssistantTurnStart SessionEventType = "assistant.turn_start" - SessionEventTypeAssistantIntent SessionEventType = "assistant.intent" - SessionEventTypeAssistantReasoning SessionEventType = "assistant.reasoning" - SessionEventTypeAssistantReasoningDelta SessionEventType = "assistant.reasoning_delta" - SessionEventTypeAssistantStreamingDelta SessionEventType = "assistant.streaming_delta" - SessionEventTypeAssistantMessage SessionEventType = "assistant.message" - SessionEventTypeAssistantMessageDelta SessionEventType = "assistant.message_delta" - SessionEventTypeAssistantTurnEnd SessionEventType = "assistant.turn_end" - SessionEventTypeAssistantUsage SessionEventType = "assistant.usage" - SessionEventTypeAbort SessionEventType = "abort" - SessionEventTypeToolUserRequested SessionEventType = "tool.user_requested" - SessionEventTypeToolExecutionStart SessionEventType = "tool.execution_start" - SessionEventTypeToolExecutionPartialResult SessionEventType = "tool.execution_partial_result" - SessionEventTypeToolExecutionProgress SessionEventType = "tool.execution_progress" - SessionEventTypeToolExecutionComplete SessionEventType = "tool.execution_complete" - SessionEventTypeSkillInvoked SessionEventType = "skill.invoked" - SessionEventTypeSubagentStarted SessionEventType = "subagent.started" - SessionEventTypeSubagentCompleted SessionEventType = "subagent.completed" - SessionEventTypeSubagentFailed SessionEventType = "subagent.failed" - SessionEventTypeSubagentSelected SessionEventType = "subagent.selected" - SessionEventTypeSubagentDeselected SessionEventType = "subagent.deselected" - SessionEventTypeHookStart SessionEventType = "hook.start" - SessionEventTypeHookEnd SessionEventType = "hook.end" - SessionEventTypeSystemMessage SessionEventType = "system.message" - SessionEventTypeSystemNotification SessionEventType = "system.notification" - SessionEventTypePermissionRequested SessionEventType = "permission.requested" - SessionEventTypePermissionCompleted SessionEventType = "permission.completed" - SessionEventTypeUserInputRequested SessionEventType = "user_input.requested" - SessionEventTypeUserInputCompleted SessionEventType = "user_input.completed" - SessionEventTypeElicitationRequested SessionEventType = "elicitation.requested" - SessionEventTypeElicitationCompleted SessionEventType = "elicitation.completed" - SessionEventTypeSamplingRequested SessionEventType = "sampling.requested" - SessionEventTypeSamplingCompleted SessionEventType = "sampling.completed" - SessionEventTypeMcpOauthRequired SessionEventType = "mcp.oauth_required" - SessionEventTypeMcpOauthCompleted SessionEventType = "mcp.oauth_completed" - SessionEventTypeExternalToolRequested SessionEventType = "external_tool.requested" - SessionEventTypeExternalToolCompleted SessionEventType = "external_tool.completed" - SessionEventTypeCommandQueued SessionEventType = "command.queued" - SessionEventTypeCommandExecute SessionEventType = "command.execute" - SessionEventTypeCommandCompleted SessionEventType = "command.completed" - SessionEventTypeAutoModeSwitchRequested SessionEventType = "auto_mode_switch.requested" - SessionEventTypeAutoModeSwitchCompleted SessionEventType = "auto_mode_switch.completed" - SessionEventTypeCommandsChanged SessionEventType = "commands.changed" - SessionEventTypeCapabilitiesChanged SessionEventType = "capabilities.changed" - SessionEventTypeExitPlanModeRequested SessionEventType = "exit_plan_mode.requested" - SessionEventTypeExitPlanModeCompleted SessionEventType = "exit_plan_mode.completed" - SessionEventTypeSessionToolsUpdated SessionEventType = "session.tools_updated" + SessionEventTypeSessionError SessionEventType = "session.error" + SessionEventTypeSessionIdle SessionEventType = "session.idle" + SessionEventTypeSessionTitleChanged SessionEventType = "session.title_changed" + SessionEventTypeSessionInfo SessionEventType = "session.info" + SessionEventTypeSessionWarning SessionEventType = "session.warning" + SessionEventTypeSessionModelChange SessionEventType = "session.model_change" + SessionEventTypeSessionModeChanged SessionEventType = "session.mode_changed" + SessionEventTypeSessionPlanChanged SessionEventType = "session.plan_changed" + SessionEventTypeSessionWorkspaceFileChanged SessionEventType = "session.workspace_file_changed" + SessionEventTypeSessionHandoff SessionEventType = "session.handoff" + SessionEventTypeSessionTruncation SessionEventType = "session.truncation" + SessionEventTypeSessionSnapshotRewind SessionEventType = "session.snapshot_rewind" + SessionEventTypeSessionShutdown SessionEventType = "session.shutdown" + SessionEventTypeSessionContextChanged SessionEventType = "session.context_changed" + SessionEventTypeSessionUsageInfo SessionEventType = "session.usage_info" + SessionEventTypeSessionCompactionStart SessionEventType = "session.compaction_start" + SessionEventTypeSessionCompactionComplete SessionEventType = "session.compaction_complete" + SessionEventTypeSessionTaskComplete SessionEventType = "session.task_complete" + SessionEventTypeUserMessage SessionEventType = "user.message" + SessionEventTypePendingMessagesModified SessionEventType = "pending_messages.modified" + SessionEventTypeAssistantTurnStart SessionEventType = "assistant.turn_start" + SessionEventTypeAssistantIntent SessionEventType = "assistant.intent" + SessionEventTypeAssistantReasoning SessionEventType = "assistant.reasoning" + SessionEventTypeAssistantReasoningDelta SessionEventType = "assistant.reasoning_delta" + SessionEventTypeAssistantStreamingDelta SessionEventType = "assistant.streaming_delta" + SessionEventTypeAssistantMessage SessionEventType = "assistant.message" + SessionEventTypeAssistantMessageDelta SessionEventType = "assistant.message_delta" + SessionEventTypeAssistantTurnEnd SessionEventType = "assistant.turn_end" + SessionEventTypeAssistantUsage SessionEventType = "assistant.usage" + SessionEventTypeModelCallFailure SessionEventType = "model.call_failure" + SessionEventTypeAbort SessionEventType = "abort" + SessionEventTypeToolUserRequested SessionEventType = "tool.user_requested" + SessionEventTypeToolExecutionStart SessionEventType = "tool.execution_start" + SessionEventTypeToolExecutionPartialResult SessionEventType = "tool.execution_partial_result" + SessionEventTypeToolExecutionProgress SessionEventType = "tool.execution_progress" + SessionEventTypeToolExecutionComplete SessionEventType = "tool.execution_complete" + SessionEventTypeSkillInvoked SessionEventType = "skill.invoked" + SessionEventTypeSubagentStarted SessionEventType = "subagent.started" + SessionEventTypeSubagentCompleted SessionEventType = "subagent.completed" + SessionEventTypeSubagentFailed SessionEventType = "subagent.failed" + SessionEventTypeSubagentSelected SessionEventType = "subagent.selected" + SessionEventTypeSubagentDeselected SessionEventType = "subagent.deselected" + SessionEventTypeHookStart SessionEventType = "hook.start" + SessionEventTypeHookEnd SessionEventType = "hook.end" + SessionEventTypeSystemMessage SessionEventType = "system.message" + SessionEventTypeSystemNotification SessionEventType = "system.notification" + SessionEventTypePermissionRequested SessionEventType = "permission.requested" + SessionEventTypePermissionCompleted SessionEventType = "permission.completed" + SessionEventTypeUserInputRequested SessionEventType = "user_input.requested" + SessionEventTypeUserInputCompleted SessionEventType = "user_input.completed" + SessionEventTypeElicitationRequested SessionEventType = "elicitation.requested" + SessionEventTypeElicitationCompleted SessionEventType = "elicitation.completed" + SessionEventTypeSamplingRequested SessionEventType = "sampling.requested" + SessionEventTypeSamplingCompleted SessionEventType = "sampling.completed" + SessionEventTypeMcpOauthRequired SessionEventType = "mcp.oauth_required" + SessionEventTypeMcpOauthCompleted SessionEventType = "mcp.oauth_completed" + SessionEventTypeExternalToolRequested SessionEventType = "external_tool.requested" + SessionEventTypeExternalToolCompleted SessionEventType = "external_tool.completed" + SessionEventTypeCommandQueued SessionEventType = "command.queued" + SessionEventTypeCommandExecute SessionEventType = "command.execute" + SessionEventTypeCommandCompleted SessionEventType = "command.completed" + SessionEventTypeAutoModeSwitchRequested SessionEventType = "auto_mode_switch.requested" + SessionEventTypeAutoModeSwitchCompleted SessionEventType = "auto_mode_switch.completed" + SessionEventTypeCommandsChanged SessionEventType = "commands.changed" + SessionEventTypeCapabilitiesChanged SessionEventType = "capabilities.changed" + SessionEventTypeExitPlanModeRequested SessionEventType = "exit_plan_mode.requested" + SessionEventTypeExitPlanModeCompleted SessionEventType = "exit_plan_mode.completed" + SessionEventTypeSessionToolsUpdated SessionEventType = "session.tools_updated" SessionEventTypeSessionBackgroundTasksChanged SessionEventType = "session.background_tasks_changed" - SessionEventTypeSessionSkillsLoaded SessionEventType = "session.skills_loaded" - SessionEventTypeSessionCustomAgentsUpdated SessionEventType = "session.custom_agents_updated" - SessionEventTypeSessionMcpServersLoaded SessionEventType = "session.mcp_servers_loaded" + SessionEventTypeSessionSkillsLoaded SessionEventType = "session.skills_loaded" + SessionEventTypeSessionCustomAgentsUpdated SessionEventType = "session.custom_agents_updated" + SessionEventTypeSessionMcpServersLoaded SessionEventType = "session.mcp_servers_loaded" SessionEventTypeSessionMcpServerStatusChanged SessionEventType = "session.mcp_server_status_changed" - SessionEventTypeSessionExtensionsLoaded SessionEventType = "session.extensions_loaded" + SessionEventTypeSessionExtensionsLoaded SessionEventType = "session.extensions_loaded" ) // Agent intent description for current activity or plan @@ -707,6 +714,8 @@ type AutoModeSwitchRequestedData struct { ErrorCode *string `json:"errorCode,omitempty"` // Unique identifier for this request; used to respond via session.respondToAutoModeSwitch() RequestID string `json:"requestId"` + // Seconds until the rate limit resets, when known. Lets clients render a humanized reset time alongside the prompt. + RetryAfterSeconds *float64 `json:"retryAfterSeconds,omitempty"` } func (*AutoModeSwitchRequestedData) sessionEventData() {} @@ -859,6 +868,10 @@ func (*PendingMessagesModifiedData) sessionEventData() {} // Error details for timeline display including message and optional diagnostic information type SessionErrorData struct { + // Only set on `errorType: "rate_limit"`. When `true`, the runtime will follow this error with an `auto_mode_switch.requested` event (or silently switch if `continueOnAutoMode` is enabled). UI clients can use this flag to suppress duplicate rendering of the rate-limit error when they show their own auto-mode-switch prompt. + EligibleForAutoSwitch *bool `json:"eligibleForAutoSwitch,omitempty"` + // Fine-grained error code from the upstream provider, when available. For `errorType: "rate_limit"`, this is one of the `RateLimitErrorCode` values (e.g., `"user_weekly_rate_limited"`, `"user_global_rate_limited"`, `"rate_limited"`, `"user_model_rate_limited"`, `"integration_rate_limited"`). + ErrorCode *string `json:"errorCode,omitempty"` // Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query") ErrorType string `json:"errorType"` // Human-readable error message @@ -903,6 +916,28 @@ type ExternalToolRequestedData struct { func (*ExternalToolRequestedData) sessionEventData() {} +// Failed LLM API call metadata for telemetry +type ModelCallFailureData struct { + // Completion ID from the model provider (e.g., chatcmpl-abc123) + APICallID *string `json:"apiCallId,omitempty"` + // Duration of the failed API call in milliseconds + DurationMs *float64 `json:"durationMs,omitempty"` + // Raw provider/runtime error message for restricted telemetry + ErrorMessage *string `json:"errorMessage,omitempty"` + // What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls + Initiator *string `json:"initiator,omitempty"` + // Model identifier used for the failed API call + Model *string `json:"model,omitempty"` + // GitHub request tracing ID (x-github-request-id header) for server-side log correlation + ProviderCallID *string `json:"providerCallId,omitempty"` + // Where the failed model call originated + Source ModelCallFailureSource `json:"source"` + // HTTP status code from the failed request + StatusCode *int64 `json:"statusCode,omitempty"` +} + +func (*ModelCallFailureData) sessionEventData() {} + // Hook invocation completion details including output, success status, and error information type HookEndData struct { // Error details when the hook failed @@ -937,6 +972,8 @@ type SessionInfoData struct { InfoType string `json:"infoType"` // Human-readable informational message for display in the timeline Message string `json:"message"` + // Optional actionable tip displayed with this message + Tip *string `json:"tip,omitempty"` // Optional URL associated with this message that the user can open in a browser URL *string `json:"url,omitempty"` } @@ -994,6 +1031,8 @@ func (*McpOauthCompletedData) sessionEventData() {} // Model change details including previous and new model identifiers type SessionModelChangeData struct { + // Reason the change happened, when not user-initiated. Currently `"rate_limit_auto_switch"` for changes triggered by the auto-mode-switch rate-limit recovery path. UI clients can use this to render contextual copy. + Cause *string `json:"cause,omitempty"` // Newly selected model identifier NewModel string `json:"newModel"` // Model that was previously selected, if any @@ -2028,7 +2067,7 @@ type SystemNotification struct { Prompt *string `json:"prompt,omitempty"` // Human-readable name of the sender SenderName *string `json:"senderName,omitempty"` - // Category of the sender (e.g., ambient-agent, plugin, hook) + // Category of the sender (e.g., sidekick-agent, plugin, hook) SenderType *string `json:"senderType,omitempty"` // Unique identifier of the shell session ShellID *string `json:"shellId,omitempty"` @@ -2157,7 +2196,7 @@ type AssistantUsageQuotaSnapshot struct { type CommandsChangedCommand struct { Description *string `json:"description,omitempty"` - Name string `json:"name"` + Name string `json:"name"` } type CustomAgentsUpdatedAgent struct { @@ -2239,11 +2278,11 @@ type SkillsLoadedSkill struct { type McpServersLoadedServerStatus string const ( - McpServersLoadedServerStatusConnected McpServersLoadedServerStatus = "connected" - McpServersLoadedServerStatusFailed McpServersLoadedServerStatus = "failed" - McpServersLoadedServerStatusNeedsAuth McpServersLoadedServerStatus = "needs-auth" - McpServersLoadedServerStatusPending McpServersLoadedServerStatus = "pending" - McpServersLoadedServerStatusDisabled McpServersLoadedServerStatus = "disabled" + McpServersLoadedServerStatusConnected McpServersLoadedServerStatus = "connected" + McpServersLoadedServerStatusFailed McpServersLoadedServerStatus = "failed" + McpServersLoadedServerStatusNeedsAuth McpServersLoadedServerStatus = "needs-auth" + McpServersLoadedServerStatusPending McpServersLoadedServerStatus = "pending" + McpServersLoadedServerStatusDisabled McpServersLoadedServerStatus = "disabled" McpServersLoadedServerStatusNotConfigured McpServersLoadedServerStatus = "not_configured" ) @@ -2251,9 +2290,9 @@ const ( type ExtensionsLoadedExtensionStatus string const ( - ExtensionsLoadedExtensionStatusRunning ExtensionsLoadedExtensionStatus = "running" + ExtensionsLoadedExtensionStatusRunning ExtensionsLoadedExtensionStatus = "running" ExtensionsLoadedExtensionStatusDisabled ExtensionsLoadedExtensionStatus = "disabled" - ExtensionsLoadedExtensionStatusFailed ExtensionsLoadedExtensionStatus = "failed" + ExtensionsLoadedExtensionStatusFailed ExtensionsLoadedExtensionStatus = "failed" ExtensionsLoadedExtensionStatusStarting ExtensionsLoadedExtensionStatus = "starting" ) @@ -2262,7 +2301,7 @@ type ExtensionsLoadedExtensionSource string const ( ExtensionsLoadedExtensionSourceProject ExtensionsLoadedExtensionSource = "project" - ExtensionsLoadedExtensionSourceUser ExtensionsLoadedExtensionSource = "user" + ExtensionsLoadedExtensionSourceUser ExtensionsLoadedExtensionSource = "user" ) // Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent. @@ -2270,7 +2309,7 @@ type ElicitationRequestedMode string const ( ElicitationRequestedModeForm ElicitationRequestedMode = "form" - ElicitationRequestedModeURL ElicitationRequestedMode = "url" + ElicitationRequestedModeURL ElicitationRequestedMode = "url" ) // Hosting platform type of the repository (github or ado) @@ -2278,43 +2317,43 @@ type WorkingDirectoryContextHostType string const ( WorkingDirectoryContextHostTypeGithub WorkingDirectoryContextHostType = "github" - WorkingDirectoryContextHostTypeAdo WorkingDirectoryContextHostType = "ado" + WorkingDirectoryContextHostTypeAdo WorkingDirectoryContextHostType = "ado" ) // Kind discriminator for PermissionPromptRequest. type PermissionPromptRequestKind string const ( - PermissionPromptRequestKindCommands PermissionPromptRequestKind = "commands" - PermissionPromptRequestKindWrite PermissionPromptRequestKind = "write" - PermissionPromptRequestKindRead PermissionPromptRequestKind = "read" - PermissionPromptRequestKindMcp PermissionPromptRequestKind = "mcp" - PermissionPromptRequestKindURL PermissionPromptRequestKind = "url" - PermissionPromptRequestKindMemory PermissionPromptRequestKind = "memory" + PermissionPromptRequestKindCommands PermissionPromptRequestKind = "commands" + PermissionPromptRequestKindWrite PermissionPromptRequestKind = "write" + PermissionPromptRequestKindRead PermissionPromptRequestKind = "read" + PermissionPromptRequestKindMcp PermissionPromptRequestKind = "mcp" + PermissionPromptRequestKindURL PermissionPromptRequestKind = "url" + PermissionPromptRequestKindMemory PermissionPromptRequestKind = "memory" PermissionPromptRequestKindCustomTool PermissionPromptRequestKind = "custom-tool" - PermissionPromptRequestKindPath PermissionPromptRequestKind = "path" - PermissionPromptRequestKindHook PermissionPromptRequestKind = "hook" + PermissionPromptRequestKindPath PermissionPromptRequestKind = "path" + PermissionPromptRequestKindHook PermissionPromptRequestKind = "hook" ) // Kind discriminator for PermissionRequest. type PermissionRequestKind string const ( - PermissionRequestKindShell PermissionRequestKind = "shell" - PermissionRequestKindWrite PermissionRequestKind = "write" - PermissionRequestKindRead PermissionRequestKind = "read" - PermissionRequestKindMcp PermissionRequestKind = "mcp" - PermissionRequestKindURL PermissionRequestKind = "url" - PermissionRequestKindMemory PermissionRequestKind = "memory" + PermissionRequestKindShell PermissionRequestKind = "shell" + PermissionRequestKindWrite PermissionRequestKind = "write" + PermissionRequestKindRead PermissionRequestKind = "read" + PermissionRequestKindMcp PermissionRequestKind = "mcp" + PermissionRequestKindURL PermissionRequestKind = "url" + PermissionRequestKindMemory PermissionRequestKind = "memory" PermissionRequestKindCustomTool PermissionRequestKind = "custom-tool" - PermissionRequestKindHook PermissionRequestKind = "hook" + PermissionRequestKindHook PermissionRequestKind = "hook" ) // Message role: "system" for system prompts, "developer" for developer-injected instructions type SystemMessageRole string const ( - SystemMessageRoleSystem SystemMessageRole = "system" + SystemMessageRoleSystem SystemMessageRole = "system" SystemMessageRoleDeveloper SystemMessageRole = "developer" ) @@ -2322,11 +2361,11 @@ const ( type McpServerStatusChangedStatus string const ( - McpServerStatusChangedStatusConnected McpServerStatusChangedStatus = "connected" - McpServerStatusChangedStatusFailed McpServerStatusChangedStatus = "failed" - McpServerStatusChangedStatusNeedsAuth McpServerStatusChangedStatus = "needs-auth" - McpServerStatusChangedStatusPending McpServerStatusChangedStatus = "pending" - McpServerStatusChangedStatusDisabled McpServerStatusChangedStatus = "disabled" + McpServerStatusChangedStatusConnected McpServerStatusChangedStatus = "connected" + McpServerStatusChangedStatusFailed McpServerStatusChangedStatus = "failed" + McpServerStatusChangedStatusNeedsAuth McpServerStatusChangedStatus = "needs-auth" + McpServerStatusChangedStatusPending McpServerStatusChangedStatus = "pending" + McpServerStatusChangedStatusDisabled McpServerStatusChangedStatus = "disabled" McpServerStatusChangedStatusNotConfigured McpServerStatusChangedStatus = "not_configured" ) @@ -2335,7 +2374,7 @@ type HandoffSourceType string const ( HandoffSourceTypeRemote HandoffSourceType = "remote" - HandoffSourceTypeLocal HandoffSourceType = "local" + HandoffSourceTypeLocal HandoffSourceType = "local" ) // The agent mode that was active when this message was sent @@ -2343,23 +2382,23 @@ type UserMessageAgentMode string const ( UserMessageAgentModeInteractive UserMessageAgentMode = "interactive" - UserMessageAgentModePlan UserMessageAgentMode = "plan" - UserMessageAgentModeAutopilot UserMessageAgentMode = "autopilot" - UserMessageAgentModeShell UserMessageAgentMode = "shell" + UserMessageAgentModePlan UserMessageAgentMode = "plan" + UserMessageAgentModeAutopilot UserMessageAgentMode = "autopilot" + UserMessageAgentModeShell UserMessageAgentMode = "shell" ) // The outcome of the permission request type PermissionCompletedKind string const ( - PermissionCompletedKindApproved PermissionCompletedKind = "approved" - PermissionCompletedKindApprovedForSession PermissionCompletedKind = "approved-for-session" - PermissionCompletedKindApprovedForLocation PermissionCompletedKind = "approved-for-location" - PermissionCompletedKindDeniedByRules PermissionCompletedKind = "denied-by-rules" + PermissionCompletedKindApproved PermissionCompletedKind = "approved" + PermissionCompletedKindApprovedForSession PermissionCompletedKind = "approved-for-session" + PermissionCompletedKindApprovedForLocation PermissionCompletedKind = "approved-for-location" + PermissionCompletedKindDeniedByRules PermissionCompletedKind = "denied-by-rules" PermissionCompletedKindDeniedNoApprovalRuleAndCouldNotRequestFromUser PermissionCompletedKind = "denied-no-approval-rule-and-could-not-request-from-user" - PermissionCompletedKindDeniedInteractivelyByUser PermissionCompletedKind = "denied-interactively-by-user" - PermissionCompletedKindDeniedByContentExclusionPolicy PermissionCompletedKind = "denied-by-content-exclusion-policy" - PermissionCompletedKindDeniedByPermissionRequestHook PermissionCompletedKind = "denied-by-permission-request-hook" + PermissionCompletedKindDeniedInteractivelyByUser PermissionCompletedKind = "denied-interactively-by-user" + PermissionCompletedKindDeniedByContentExclusionPolicy PermissionCompletedKind = "denied-by-content-exclusion-policy" + PermissionCompletedKindDeniedByPermissionRequestHook PermissionCompletedKind = "denied-by-permission-request-hook" ) // The type of operation performed on the plan file @@ -2375,9 +2414,9 @@ const ( type ElicitationCompletedAction string const ( - ElicitationCompletedActionAccept ElicitationCompletedAction = "accept" + ElicitationCompletedActionAccept ElicitationCompletedAction = "accept" ElicitationCompletedActionDecline ElicitationCompletedAction = "decline" - ElicitationCompletedActionCancel ElicitationCompletedAction = "cancel" + ElicitationCompletedActionCancel ElicitationCompletedAction = "cancel" ) // Theme variant this icon is intended for @@ -2385,7 +2424,7 @@ type ToolExecutionCompleteContentResourceLinkIconTheme string const ( ToolExecutionCompleteContentResourceLinkIconThemeLight ToolExecutionCompleteContentResourceLinkIconTheme = "light" - ToolExecutionCompleteContentResourceLinkIconThemeDark ToolExecutionCompleteContentResourceLinkIconTheme = "dark" + ToolExecutionCompleteContentResourceLinkIconThemeDark ToolExecutionCompleteContentResourceLinkIconTheme = "dark" ) // Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent. @@ -2393,17 +2432,17 @@ type AssistantMessageToolRequestType string const ( AssistantMessageToolRequestTypeFunction AssistantMessageToolRequestType = "function" - AssistantMessageToolRequestTypeCustom AssistantMessageToolRequestType = "custom" + AssistantMessageToolRequestTypeCustom AssistantMessageToolRequestType = "custom" ) // Type discriminator for SystemNotification. type SystemNotificationType string const ( - SystemNotificationTypeAgentCompleted SystemNotificationType = "agent_completed" - SystemNotificationTypeAgentIdle SystemNotificationType = "agent_idle" - SystemNotificationTypeNewInboxMessage SystemNotificationType = "new_inbox_message" - SystemNotificationTypeShellCompleted SystemNotificationType = "shell_completed" + SystemNotificationTypeAgentCompleted SystemNotificationType = "agent_completed" + SystemNotificationTypeAgentIdle SystemNotificationType = "agent_idle" + SystemNotificationTypeNewInboxMessage SystemNotificationType = "new_inbox_message" + SystemNotificationTypeShellCompleted SystemNotificationType = "shell_completed" SystemNotificationTypeShellDetachedCompleted SystemNotificationType = "shell_detached_completed" ) @@ -2411,31 +2450,31 @@ const ( type ToolExecutionCompleteContentType string const ( - ToolExecutionCompleteContentTypeText ToolExecutionCompleteContentType = "text" - ToolExecutionCompleteContentTypeTerminal ToolExecutionCompleteContentType = "terminal" - ToolExecutionCompleteContentTypeImage ToolExecutionCompleteContentType = "image" - ToolExecutionCompleteContentTypeAudio ToolExecutionCompleteContentType = "audio" + ToolExecutionCompleteContentTypeText ToolExecutionCompleteContentType = "text" + ToolExecutionCompleteContentTypeTerminal ToolExecutionCompleteContentType = "terminal" + ToolExecutionCompleteContentTypeImage ToolExecutionCompleteContentType = "image" + ToolExecutionCompleteContentTypeAudio ToolExecutionCompleteContentType = "audio" ToolExecutionCompleteContentTypeResourceLink ToolExecutionCompleteContentType = "resource_link" - ToolExecutionCompleteContentTypeResource ToolExecutionCompleteContentType = "resource" + ToolExecutionCompleteContentTypeResource ToolExecutionCompleteContentType = "resource" ) // Type discriminator for UserMessageAttachment. type UserMessageAttachmentType string const ( - UserMessageAttachmentTypeFile UserMessageAttachmentType = "file" - UserMessageAttachmentTypeDirectory UserMessageAttachmentType = "directory" - UserMessageAttachmentTypeSelection UserMessageAttachmentType = "selection" + UserMessageAttachmentTypeFile UserMessageAttachmentType = "file" + UserMessageAttachmentTypeDirectory UserMessageAttachmentType = "directory" + UserMessageAttachmentTypeSelection UserMessageAttachmentType = "selection" UserMessageAttachmentTypeGithubReference UserMessageAttachmentType = "github_reference" - UserMessageAttachmentTypeBlob UserMessageAttachmentType = "blob" + UserMessageAttachmentTypeBlob UserMessageAttachmentType = "blob" ) // Type of GitHub reference type UserMessageAttachmentGithubReferenceType string const ( - UserMessageAttachmentGithubReferenceTypeIssue UserMessageAttachmentGithubReferenceType = "issue" - UserMessageAttachmentGithubReferenceTypePr UserMessageAttachmentGithubReferenceType = "pr" + UserMessageAttachmentGithubReferenceTypeIssue UserMessageAttachmentGithubReferenceType = "issue" + UserMessageAttachmentGithubReferenceTypePr UserMessageAttachmentGithubReferenceType = "pr" UserMessageAttachmentGithubReferenceTypeDiscussion UserMessageAttachmentGithubReferenceType = "discussion" ) @@ -2443,7 +2482,7 @@ const ( type PermissionPromptRequestPathAccessKind string const ( - PermissionPromptRequestPathAccessKindRead PermissionPromptRequestPathAccessKind = "read" + PermissionPromptRequestPathAccessKindRead PermissionPromptRequestPathAccessKind = "read" PermissionPromptRequestPathAccessKindShell PermissionPromptRequestPathAccessKind = "shell" PermissionPromptRequestPathAccessKindWrite PermissionPromptRequestPathAccessKind = "write" ) @@ -2452,7 +2491,7 @@ const ( type PermissionPromptRequestMemoryDirection string const ( - PermissionPromptRequestMemoryDirectionUpvote PermissionPromptRequestMemoryDirection = "upvote" + PermissionPromptRequestMemoryDirectionUpvote PermissionPromptRequestMemoryDirection = "upvote" PermissionPromptRequestMemoryDirectionDownvote PermissionPromptRequestMemoryDirection = "downvote" ) @@ -2460,16 +2499,25 @@ const ( type PermissionRequestMemoryDirection string const ( - PermissionRequestMemoryDirectionUpvote PermissionRequestMemoryDirection = "upvote" + PermissionRequestMemoryDirectionUpvote PermissionRequestMemoryDirection = "upvote" PermissionRequestMemoryDirectionDownvote PermissionRequestMemoryDirection = "downvote" ) +// Where the failed model call originated +type ModelCallFailureSource string + +const ( + ModelCallFailureSourceTopLevel ModelCallFailureSource = "top_level" + ModelCallFailureSourceSubagent ModelCallFailureSource = "subagent" + ModelCallFailureSourceMcpSampling ModelCallFailureSource = "mcp_sampling" +) + // Whether the agent completed successfully or failed type SystemNotificationAgentCompletedStatus string const ( SystemNotificationAgentCompletedStatusCompleted SystemNotificationAgentCompletedStatus = "completed" - SystemNotificationAgentCompletedStatusFailed SystemNotificationAgentCompletedStatus = "failed" + SystemNotificationAgentCompletedStatusFailed SystemNotificationAgentCompletedStatus = "failed" ) // Whether the file was newly created or updated @@ -2485,7 +2533,7 @@ type ShutdownType string const ( ShutdownTypeRoutine ShutdownType = "routine" - ShutdownTypeError ShutdownType = "error" + ShutdownTypeError ShutdownType = "error" ) // Whether this is a store or vote memory operation @@ -2493,7 +2541,7 @@ type PermissionPromptRequestMemoryAction string const ( PermissionPromptRequestMemoryActionStore PermissionPromptRequestMemoryAction = "store" - PermissionPromptRequestMemoryActionVote PermissionPromptRequestMemoryAction = "vote" + PermissionPromptRequestMemoryActionVote PermissionPromptRequestMemoryAction = "vote" ) // Whether this is a store or vote memory operation @@ -2501,22 +2549,22 @@ type PermissionRequestMemoryAction string const ( PermissionRequestMemoryActionStore PermissionRequestMemoryAction = "store" - PermissionRequestMemoryActionVote PermissionRequestMemoryAction = "vote" + PermissionRequestMemoryActionVote PermissionRequestMemoryAction = "vote" ) // Type aliases for convenience. type ( PermissionRequestCommand = PermissionRequestShellCommand - PossibleURL = PermissionRequestShellPossibleURL - Attachment = UserMessageAttachment - AttachmentType = UserMessageAttachmentType + PossibleURL = PermissionRequestShellPossibleURL + Attachment = UserMessageAttachment + AttachmentType = UserMessageAttachmentType ) // Constant aliases for convenience. const ( - AttachmentTypeFile = UserMessageAttachmentTypeFile - AttachmentTypeDirectory = UserMessageAttachmentTypeDirectory - AttachmentTypeSelection = UserMessageAttachmentTypeSelection + AttachmentTypeFile = UserMessageAttachmentTypeFile + AttachmentTypeDirectory = UserMessageAttachmentTypeDirectory + AttachmentTypeSelection = UserMessageAttachmentTypeSelection AttachmentTypeGithubReference = UserMessageAttachmentTypeGithubReference - AttachmentTypeBlob = UserMessageAttachmentTypeBlob + AttachmentTypeBlob = UserMessageAttachmentTypeBlob ) diff --git a/go/rpc/generated_rpc.go b/go/rpc/generated_rpc.go index 2efcb494f..cba56351d 100644 --- a/go/rpc/generated_rpc.go +++ b/go/rpc/generated_rpc.go @@ -6,10 +6,10 @@ package rpc import ( "context" "encoding/json" + "time" "errors" "fmt" "github.com/github/copilot-sdk/go/internal/jsonrpc2" - "time" ) type RPCTypes struct { @@ -184,6 +184,23 @@ type RPCTypes struct { SkillsEnableRequest SkillsEnableRequest `json:"SkillsEnableRequest"` SkillsEnableResult SkillsEnableResult `json:"SkillsEnableResult"` SkillsReloadResult SkillsReloadResult `json:"SkillsReloadResult"` + TaskAgentInfo TaskAgentInfo `json:"TaskAgentInfo"` + TaskAgentInfoExecutionMode TaskInfoExecutionMode `json:"TaskAgentInfoExecutionMode"` + TaskAgentInfoStatus TaskInfoStatus `json:"TaskAgentInfoStatus"` + TaskInfo TaskInfo `json:"TaskInfo"` + TaskList TaskList `json:"TaskList"` + TasksCancelRequest TasksCancelRequest `json:"TasksCancelRequest"` + TasksCancelResult TasksCancelResult `json:"TasksCancelResult"` + TaskShellInfo TaskShellInfo `json:"TaskShellInfo"` + TaskShellInfoAttachmentMode TaskShellInfoAttachmentMode `json:"TaskShellInfoAttachmentMode"` + TaskShellInfoExecutionMode TaskInfoExecutionMode `json:"TaskShellInfoExecutionMode"` + TaskShellInfoStatus TaskInfoStatus `json:"TaskShellInfoStatus"` + TasksPromoteToBackgroundRequest TasksPromoteToBackgroundRequest `json:"TasksPromoteToBackgroundRequest"` + TasksPromoteToBackgroundResult TasksPromoteToBackgroundResult `json:"TasksPromoteToBackgroundResult"` + TasksRemoveRequest TasksRemoveRequest `json:"TasksRemoveRequest"` + TasksRemoveResult TasksRemoveResult `json:"TasksRemoveResult"` + TasksStartAgentRequest TasksStartAgentRequest `json:"TasksStartAgentRequest"` + TasksStartAgentResult TasksStartAgentResult `json:"TasksStartAgentResult"` Tool Tool `json:"Tool"` ToolCallResult ToolCallResult `json:"ToolCallResult"` ToolList ToolList `json:"ToolList"` @@ -228,31 +245,31 @@ type RPCTypes struct { type AccountGetQuotaRequest struct { // GitHub token for per-user quota lookup. When provided, resolves this token to determine // the user's quota instead of using the global auth. - GitHubToken *string `json:"gitHubToken,omitempty"` + GitHubToken *string `json:"gitHubToken,omitempty"` } type AccountGetQuotaResult struct { // Quota snapshots keyed by type (e.g., chat, completions, premium_interactions) - QuotaSnapshots map[string]AccountQuotaSnapshot `json:"quotaSnapshots"` + QuotaSnapshots map[string]AccountQuotaSnapshot `json:"quotaSnapshots"` } type AccountQuotaSnapshot struct { // Number of requests included in the entitlement - EntitlementRequests int64 `json:"entitlementRequests"` + EntitlementRequests int64 `json:"entitlementRequests"` // Whether the user has an unlimited usage entitlement - IsUnlimitedEntitlement bool `json:"isUnlimitedEntitlement"` + IsUnlimitedEntitlement bool `json:"isUnlimitedEntitlement"` // Number of overage requests made this period - Overage float64 `json:"overage"` + Overage float64 `json:"overage"` // Whether overage is allowed when quota is exhausted - OverageAllowedWithExhaustedQuota bool `json:"overageAllowedWithExhaustedQuota"` + OverageAllowedWithExhaustedQuota bool `json:"overageAllowedWithExhaustedQuota"` // Percentage of entitlement remaining - RemainingPercentage float64 `json:"remainingPercentage"` + RemainingPercentage float64 `json:"remainingPercentage"` // Date when the quota resets (ISO 8601 string) - ResetDate *string `json:"resetDate,omitempty"` + ResetDate *string `json:"resetDate,omitempty"` // Whether usage is still permitted after quota exhaustion - UsageAllowedWithExhaustedQuota bool `json:"usageAllowedWithExhaustedQuota"` + UsageAllowedWithExhaustedQuota bool `json:"usageAllowedWithExhaustedQuota"` // Number of requests used so far this period - UsedRequests int64 `json:"usedRequests"` + UsedRequests int64 `json:"usedRequests"` } // Experimental: AgentDeselectResult is part of an experimental API and may change or be removed. @@ -262,94 +279,97 @@ type AgentDeselectResult struct { // Experimental: AgentGetCurrentResult is part of an experimental API and may change or be removed. type AgentGetCurrentResult struct { // Currently selected custom agent, or null if using the default agent - Agent *AgentInfo `json:"agent"` + Agent *AgentInfo `json:"agent"` } // The newly selected custom agent type AgentInfo struct { // Description of the agent's purpose - Description string `json:"description"` + Description string `json:"description"` // Human-readable display name - DisplayName string `json:"displayName"` + DisplayName string `json:"displayName"` // Unique identifier of the custom agent - Name string `json:"name"` + Name string `json:"name"` + // Absolute local file path of the agent definition. Only set for file-based agents loaded + // from disk; remote agents do not have a path. + Path *string `json:"path,omitempty"` } // Experimental: AgentList is part of an experimental API and may change or be removed. type AgentList struct { // Available custom agents - Agents []AgentInfo `json:"agents"` + Agents []AgentInfo `json:"agents"` } // Experimental: AgentReloadResult is part of an experimental API and may change or be removed. type AgentReloadResult struct { // Reloaded custom agents - Agents []AgentInfo `json:"agents"` + Agents []AgentInfo `json:"agents"` } // Experimental: AgentSelectRequest is part of an experimental API and may change or be removed. type AgentSelectRequest struct { // Name of the custom agent to select - Name string `json:"name"` + Name string `json:"name"` } // Experimental: AgentSelectResult is part of an experimental API and may change or be removed. type AgentSelectResult struct { // The newly selected custom agent - Agent AgentInfo `json:"agent"` + Agent AgentInfo `json:"agent"` } type CommandsHandlePendingCommandRequest struct { // Error message if the command handler failed - Error *string `json:"error,omitempty"` + Error *string `json:"error,omitempty"` // Request ID from the command invocation event - RequestID string `json:"requestId"` + RequestID string `json:"requestId"` } type CommandsHandlePendingCommandResult struct { // Whether the command was handled successfully - Success bool `json:"success"` + Success bool `json:"success"` } type CurrentModel struct { // Currently active model identifier - ModelID *string `json:"modelId,omitempty"` + ModelID *string `json:"modelId,omitempty"` } type DiscoveredMCPServer struct { // Whether the server is enabled (not in the disabled list) - Enabled bool `json:"enabled"` + Enabled bool `json:"enabled"` // Server name (config key) - Name string `json:"name"` + Name string `json:"name"` // Configuration source - Source MCPServerSource `json:"source"` + Source MCPServerSource `json:"source"` // Server transport type: stdio, http, sse, or memory (local configs are normalized to stdio) - Type *DiscoveredMCPServerType `json:"type,omitempty"` + Type *DiscoveredMCPServerType `json:"type,omitempty"` } type Extension struct { // Source-qualified ID (e.g., 'project:my-ext', 'user:auth-helper') - ID string `json:"id"` + ID string `json:"id"` // Extension name (directory name) - Name string `json:"name"` + Name string `json:"name"` // Process ID if the extension is running - PID *int64 `json:"pid,omitempty"` + PID *int64 `json:"pid,omitempty"` // Discovery source: project (.github/extensions/) or user (~/.copilot/extensions/) - Source ExtensionSource `json:"source"` + Source ExtensionSource `json:"source"` // Current status: running, disabled, failed, or starting - Status ExtensionStatus `json:"status"` + Status ExtensionStatus `json:"status"` } // Experimental: ExtensionList is part of an experimental API and may change or be removed. type ExtensionList struct { // Discovered extensions and their current status - Extensions []Extension `json:"extensions"` + Extensions []Extension `json:"extensions"` } // Experimental: ExtensionsDisableRequest is part of an experimental API and may change or be removed. type ExtensionsDisableRequest struct { // Source-qualified extension ID to disable - ID string `json:"id"` + ID string `json:"id"` } // Experimental: ExtensionsDisableResult is part of an experimental API and may change or be removed. @@ -359,7 +379,7 @@ type ExtensionsDisableResult struct { // Experimental: ExtensionsEnableRequest is part of an experimental API and may change or be removed. type ExtensionsEnableRequest struct { // Source-qualified extension ID to enable - ID string `json:"id"` + ID string `json:"id"` } // Experimental: ExtensionsEnableResult is part of an experimental API and may change or be removed. @@ -373,126 +393,126 @@ type ExtensionsReloadResult struct { // Experimental: FleetStartRequest is part of an experimental API and may change or be removed. type FleetStartRequest struct { // Optional user prompt to combine with fleet instructions - Prompt *string `json:"prompt,omitempty"` + Prompt *string `json:"prompt,omitempty"` } // Experimental: FleetStartResult is part of an experimental API and may change or be removed. type FleetStartResult struct { // Whether fleet mode was successfully activated - Started bool `json:"started"` + Started bool `json:"started"` } type HandleToolCallResult struct { // Whether the tool call result was handled successfully - Success bool `json:"success"` + Success bool `json:"success"` } // Post-compaction context window usage breakdown type HistoryCompactContextWindow struct { // Token count from non-system messages (user, assistant, tool) - ConversationTokens *int64 `json:"conversationTokens,omitempty"` + ConversationTokens *int64 `json:"conversationTokens,omitempty"` // Current total tokens in the context window (system + conversation + tool definitions) - CurrentTokens int64 `json:"currentTokens"` + CurrentTokens int64 `json:"currentTokens"` // Current number of messages in the conversation - MessagesLength int64 `json:"messagesLength"` + MessagesLength int64 `json:"messagesLength"` // Token count from system message(s) - SystemTokens *int64 `json:"systemTokens,omitempty"` + SystemTokens *int64 `json:"systemTokens,omitempty"` // Maximum token count for the model's context window - TokenLimit int64 `json:"tokenLimit"` + TokenLimit int64 `json:"tokenLimit"` // Token count from tool definitions - ToolDefinitionsTokens *int64 `json:"toolDefinitionsTokens,omitempty"` + ToolDefinitionsTokens *int64 `json:"toolDefinitionsTokens,omitempty"` } // Experimental: HistoryCompactResult is part of an experimental API and may change or be removed. type HistoryCompactResult struct { // Post-compaction context window usage breakdown - ContextWindow *HistoryCompactContextWindow `json:"contextWindow,omitempty"` + ContextWindow *HistoryCompactContextWindow `json:"contextWindow,omitempty"` // Number of messages removed during compaction - MessagesRemoved int64 `json:"messagesRemoved"` + MessagesRemoved int64 `json:"messagesRemoved"` // Whether compaction completed successfully - Success bool `json:"success"` + Success bool `json:"success"` // Number of tokens freed by compaction - TokensRemoved int64 `json:"tokensRemoved"` + TokensRemoved int64 `json:"tokensRemoved"` } // Experimental: HistoryTruncateRequest is part of an experimental API and may change or be removed. type HistoryTruncateRequest struct { // Event ID to truncate to. This event and all events after it are removed from the session. - EventID string `json:"eventId"` + EventID string `json:"eventId"` } // Experimental: HistoryTruncateResult is part of an experimental API and may change or be removed. type HistoryTruncateResult struct { // Number of events that were removed - EventsRemoved int64 `json:"eventsRemoved"` + EventsRemoved int64 `json:"eventsRemoved"` } type InstructionsGetSourcesResult struct { // Instruction sources for the session - Sources []InstructionsSources `json:"sources"` + Sources []InstructionsSources `json:"sources"` } type InstructionsSources struct { // Glob pattern from frontmatter — when set, this instruction applies only to matching files - ApplyTo *string `json:"applyTo,omitempty"` + ApplyTo *string `json:"applyTo,omitempty"` // Raw content of the instruction file - Content string `json:"content"` + Content string `json:"content"` // Short description (body after frontmatter) for use in instruction tables - Description *string `json:"description,omitempty"` + Description *string `json:"description,omitempty"` // Unique identifier for this source (used for toggling) - ID string `json:"id"` + ID string `json:"id"` // Human-readable label - Label string `json:"label"` + Label string `json:"label"` // Where this source lives — used for UI grouping - Location InstructionsSourcesLocation `json:"location"` + Location InstructionsSourcesLocation `json:"location"` // File path relative to repo or absolute for home - SourcePath string `json:"sourcePath"` + SourcePath string `json:"sourcePath"` // Category of instruction source — used for merge logic - Type InstructionsSourcesType `json:"type"` + Type InstructionsSourcesType `json:"type"` } type LogRequest struct { // When true, the message is transient and not persisted to the session event log on disk - Ephemeral *bool `json:"ephemeral,omitempty"` + Ephemeral *bool `json:"ephemeral,omitempty"` // Log severity level. Determines how the message is displayed in the timeline. Defaults to // "info". - Level *SessionLogLevel `json:"level,omitempty"` + Level *SessionLogLevel `json:"level,omitempty"` // Human-readable message - Message string `json:"message"` + Message string `json:"message"` // Optional URL the user can open in their browser for more details - URL *string `json:"url,omitempty"` + URL *string `json:"url,omitempty"` } type LogResult struct { // The unique identifier of the emitted session event - EventID string `json:"eventId"` + EventID string `json:"eventId"` } type MCPConfigAddRequest struct { // MCP server configuration (local/stdio or remote/http) - Config MCPServerConfig `json:"config"` + Config MCPServerConfig `json:"config"` // Unique name for the MCP server - Name string `json:"name"` + Name string `json:"name"` } // MCP server configuration (local/stdio or remote/http) type MCPServerConfig struct { - Args []string `json:"args,omitempty"` - Command *string `json:"command,omitempty"` - Cwd *string `json:"cwd,omitempty"` - Env map[string]string `json:"env,omitempty"` - FilterMapping *FilterMapping `json:"filterMapping"` - IsDefaultServer *bool `json:"isDefaultServer,omitempty"` + Args []string `json:"args,omitempty"` + Command *string `json:"command,omitempty"` + Cwd *string `json:"cwd,omitempty"` + Env map[string]string `json:"env,omitempty"` + FilterMapping *FilterMapping `json:"filterMapping"` + IsDefaultServer *bool `json:"isDefaultServer,omitempty"` // Timeout in milliseconds for tool calls to this server. - Timeout *int64 `json:"timeout,omitempty"` + Timeout *int64 `json:"timeout,omitempty"` // Tools to include. Defaults to all tools if not specified. - Tools []string `json:"tools,omitempty"` + Tools []string `json:"tools,omitempty"` // Remote transport type. Defaults to "http" when omitted. - Type *MCPServerConfigType `json:"type,omitempty"` - Headers map[string]string `json:"headers,omitempty"` - OauthClientID *string `json:"oauthClientId,omitempty"` - OauthPublicClient *bool `json:"oauthPublicClient,omitempty"` - URL *string `json:"url,omitempty"` + Type *MCPServerConfigType `json:"type,omitempty"` + Headers map[string]string `json:"headers,omitempty"` + OauthClientID *string `json:"oauthClientId,omitempty"` + OauthPublicClient *bool `json:"oauthPublicClient,omitempty"` + URL *string `json:"url,omitempty"` } type MCPConfigAddResult struct { @@ -502,7 +522,7 @@ type MCPConfigDisableRequest struct { // Names of MCP servers to disable. Each server is added to the persisted disabled list so // new sessions skip it. Already-disabled names are ignored. Active sessions keep their // current connections until they end. - Names []string `json:"names"` + Names []string `json:"names"` } type MCPConfigDisableResult struct { @@ -511,7 +531,7 @@ type MCPConfigDisableResult struct { type MCPConfigEnableRequest struct { // Names of MCP servers to enable. Each server is removed from the persisted disabled list // so new sessions spawn it. Unknown or already-enabled names are ignored. - Names []string `json:"names"` + Names []string `json:"names"` } type MCPConfigEnableResult struct { @@ -519,12 +539,12 @@ type MCPConfigEnableResult struct { type MCPConfigList struct { // All MCP servers from user config, keyed by name - Servers map[string]MCPServerConfig `json:"servers"` + Servers map[string]MCPServerConfig `json:"servers"` } type MCPConfigRemoveRequest struct { // Name of the MCP server to remove - Name string `json:"name"` + Name string `json:"name"` } type MCPConfigRemoveResult struct { @@ -532,9 +552,9 @@ type MCPConfigRemoveResult struct { type MCPConfigUpdateRequest struct { // MCP server configuration (local/stdio or remote/http) - Config MCPServerConfig `json:"config"` + Config MCPServerConfig `json:"config"` // Name of the MCP server to update - Name string `json:"name"` + Name string `json:"name"` } type MCPConfigUpdateResult struct { @@ -542,7 +562,7 @@ type MCPConfigUpdateResult struct { type MCPDisableRequest struct { // Name of the MCP server to disable - ServerName string `json:"serverName"` + ServerName string `json:"serverName"` } type MCPDisableResult struct { @@ -550,17 +570,17 @@ type MCPDisableResult struct { type MCPDiscoverRequest struct { // Working directory used as context for discovery (e.g., plugin resolution) - WorkingDirectory *string `json:"workingDirectory,omitempty"` + WorkingDirectory *string `json:"workingDirectory,omitempty"` } type MCPDiscoverResult struct { // MCP servers discovered from all sources - Servers []DiscoveredMCPServer `json:"servers"` + Servers []DiscoveredMCPServer `json:"servers"` } type MCPEnableRequest struct { // Name of the MCP server to enable - ServerName string `json:"serverName"` + ServerName string `json:"serverName"` } type MCPEnableResult struct { @@ -570,19 +590,19 @@ type MCPOauthLoginRequest struct { // Optional override for the body text shown on the OAuth loopback callback success page. // When omitted, the runtime applies a neutral fallback; callers driving interactive auth // should pass surface-specific copy telling the user where to return. - CallbackSuccessMessage *string `json:"callbackSuccessMessage,omitempty"` + CallbackSuccessMessage *string `json:"callbackSuccessMessage,omitempty"` // Optional override for the OAuth client display name shown on the consent screen. Applies // to newly registered dynamic clients only — existing registrations keep the name they were // created with. When omitted, the runtime applies a neutral fallback; callers driving // interactive auth should pass their own surface-specific label so the consent screen // matches the product the user sees. - ClientName *string `json:"clientName,omitempty"` + ClientName *string `json:"clientName,omitempty"` // When true, clears any cached OAuth token for the server and runs a full new // authorization. Use when the user explicitly wants to switch accounts or believes their // session is stuck. - ForceReauth *bool `json:"forceReauth,omitempty"` + ForceReauth *bool `json:"forceReauth,omitempty"` // Name of the remote MCP server to authenticate - ServerName string `json:"serverName"` + ServerName string `json:"serverName"` } type MCPOauthLoginResult struct { @@ -591,7 +611,7 @@ type MCPOauthLoginResult struct { // reconnected in that case. When present, the runtime starts the callback listener before // returning and continues the flow in the background; completion is signaled via // session.mcp_server_status_changed. - AuthorizationURL *string `json:"authorizationUrl,omitempty"` + AuthorizationURL *string `json:"authorizationUrl,omitempty"` } type MCPReloadResult struct { @@ -599,52 +619,52 @@ type MCPReloadResult struct { type MCPServer struct { // Error message if the server failed to connect - Error *string `json:"error,omitempty"` + Error *string `json:"error,omitempty"` // Server name (config key) - Name string `json:"name"` + Name string `json:"name"` // Configuration source: user, workspace, plugin, or builtin - Source *MCPServerSource `json:"source,omitempty"` + Source *MCPServerSource `json:"source,omitempty"` // Connection status: connected, failed, needs-auth, pending, disabled, or not_configured - Status MCPServerStatus `json:"status"` + Status MCPServerStatus `json:"status"` } type MCPServerConfigHTTP struct { - FilterMapping *FilterMapping `json:"filterMapping"` - Headers map[string]string `json:"headers,omitempty"` - IsDefaultServer *bool `json:"isDefaultServer,omitempty"` - OauthClientID *string `json:"oauthClientId,omitempty"` - OauthPublicClient *bool `json:"oauthPublicClient,omitempty"` + FilterMapping *FilterMapping `json:"filterMapping"` + Headers map[string]string `json:"headers,omitempty"` + IsDefaultServer *bool `json:"isDefaultServer,omitempty"` + OauthClientID *string `json:"oauthClientId,omitempty"` + OauthPublicClient *bool `json:"oauthPublicClient,omitempty"` // Timeout in milliseconds for tool calls to this server. - Timeout *int64 `json:"timeout,omitempty"` + Timeout *int64 `json:"timeout,omitempty"` // Tools to include. Defaults to all tools if not specified. - Tools []string `json:"tools,omitempty"` + Tools []string `json:"tools,omitempty"` // Remote transport type. Defaults to "http" when omitted. - Type *MCPServerConfigHTTPType `json:"type,omitempty"` - URL string `json:"url"` + Type *MCPServerConfigHTTPType `json:"type,omitempty"` + URL string `json:"url"` } type MCPServerConfigLocal struct { - Args []string `json:"args"` - Command string `json:"command"` - Cwd *string `json:"cwd,omitempty"` - Env map[string]string `json:"env,omitempty"` - FilterMapping *FilterMapping `json:"filterMapping"` - IsDefaultServer *bool `json:"isDefaultServer,omitempty"` + Args []string `json:"args"` + Command string `json:"command"` + Cwd *string `json:"cwd,omitempty"` + Env map[string]string `json:"env,omitempty"` + FilterMapping *FilterMapping `json:"filterMapping"` + IsDefaultServer *bool `json:"isDefaultServer,omitempty"` // Timeout in milliseconds for tool calls to this server. - Timeout *int64 `json:"timeout,omitempty"` + Timeout *int64 `json:"timeout,omitempty"` // Tools to include. Defaults to all tools if not specified. - Tools []string `json:"tools,omitempty"` - Type *MCPServerConfigLocalType `json:"type,omitempty"` + Tools []string `json:"tools,omitempty"` + Type *MCPServerConfigLocalType `json:"type,omitempty"` } type MCPServerList struct { // Configured MCP servers - Servers []MCPServer `json:"servers"` + Servers []MCPServer `json:"servers"` } type ModeSetRequest struct { // The agent mode. Valid values: "interactive", "plan", "autopilot". - Mode SessionMode `json:"mode"` + Mode SessionMode `json:"mode"` } type ModeSetResult struct { @@ -652,97 +672,97 @@ type ModeSetResult struct { type ModelElement struct { // Billing information - Billing *ModelBilling `json:"billing,omitempty"` + Billing *ModelBilling `json:"billing,omitempty"` // Model capabilities and limits - Capabilities ModelCapabilities `json:"capabilities"` + Capabilities ModelCapabilities `json:"capabilities"` // Default reasoning effort level (only present if model supports reasoning effort) - DefaultReasoningEffort *string `json:"defaultReasoningEffort,omitempty"` + DefaultReasoningEffort *string `json:"defaultReasoningEffort,omitempty"` // Model identifier (e.g., "claude-sonnet-4.5") - ID string `json:"id"` + ID string `json:"id"` // Display name - Name string `json:"name"` + Name string `json:"name"` // Policy state (if applicable) - Policy *ModelPolicy `json:"policy,omitempty"` + Policy *ModelPolicy `json:"policy,omitempty"` // Supported reasoning effort levels (only present if model supports reasoning effort) - SupportedReasoningEfforts []string `json:"supportedReasoningEfforts,omitempty"` + SupportedReasoningEfforts []string `json:"supportedReasoningEfforts,omitempty"` } // Billing information type ModelBilling struct { // Billing cost multiplier relative to the base rate - Multiplier float64 `json:"multiplier"` + Multiplier float64 `json:"multiplier"` } // Model capabilities and limits type ModelCapabilities struct { // Token limits for prompts, outputs, and context window - Limits *ModelCapabilitiesLimits `json:"limits,omitempty"` + Limits *ModelCapabilitiesLimits `json:"limits,omitempty"` // Feature flags indicating what the model supports - Supports *ModelCapabilitiesSupports `json:"supports,omitempty"` + Supports *ModelCapabilitiesSupports `json:"supports,omitempty"` } // Token limits for prompts, outputs, and context window type ModelCapabilitiesLimits struct { // Maximum total context window size in tokens - MaxContextWindowTokens *int64 `json:"max_context_window_tokens,omitempty"` + MaxContextWindowTokens *int64 `json:"max_context_window_tokens,omitempty"` // Maximum number of output/completion tokens - MaxOutputTokens *int64 `json:"max_output_tokens,omitempty"` + MaxOutputTokens *int64 `json:"max_output_tokens,omitempty"` // Maximum number of prompt/input tokens - MaxPromptTokens *int64 `json:"max_prompt_tokens,omitempty"` + MaxPromptTokens *int64 `json:"max_prompt_tokens,omitempty"` // Vision-specific limits - Vision *ModelCapabilitiesLimitsVision `json:"vision,omitempty"` + Vision *ModelCapabilitiesLimitsVision `json:"vision,omitempty"` } // Vision-specific limits type ModelCapabilitiesLimitsVision struct { // Maximum image size in bytes - MaxPromptImageSize int64 `json:"max_prompt_image_size"` + MaxPromptImageSize int64 `json:"max_prompt_image_size"` // Maximum number of images per prompt - MaxPromptImages int64 `json:"max_prompt_images"` + MaxPromptImages int64 `json:"max_prompt_images"` // MIME types the model accepts - SupportedMediaTypes []string `json:"supported_media_types"` + SupportedMediaTypes []string `json:"supported_media_types"` } // Feature flags indicating what the model supports type ModelCapabilitiesSupports struct { // Whether this model supports reasoning effort configuration - ReasoningEffort *bool `json:"reasoningEffort,omitempty"` + ReasoningEffort *bool `json:"reasoningEffort,omitempty"` // Whether this model supports vision/image input - Vision *bool `json:"vision,omitempty"` + Vision *bool `json:"vision,omitempty"` } // Policy state (if applicable) type ModelPolicy struct { // Current policy state for this model - State string `json:"state"` + State string `json:"state"` // Usage terms or conditions for this model - Terms *string `json:"terms,omitempty"` + Terms *string `json:"terms,omitempty"` } // Override individual model capabilities resolved by the runtime type ModelCapabilitiesOverride struct { // Token limits for prompts, outputs, and context window - Limits *ModelCapabilitiesOverrideLimits `json:"limits,omitempty"` + Limits *ModelCapabilitiesOverrideLimits `json:"limits,omitempty"` // Feature flags indicating what the model supports - Supports *ModelCapabilitiesOverrideSupports `json:"supports,omitempty"` + Supports *ModelCapabilitiesOverrideSupports `json:"supports,omitempty"` } // Token limits for prompts, outputs, and context window type ModelCapabilitiesOverrideLimits struct { // Maximum total context window size in tokens - MaxContextWindowTokens *int64 `json:"max_context_window_tokens,omitempty"` - MaxOutputTokens *int64 `json:"max_output_tokens,omitempty"` - MaxPromptTokens *int64 `json:"max_prompt_tokens,omitempty"` - Vision *ModelCapabilitiesOverrideLimitsVision `json:"vision,omitempty"` + MaxContextWindowTokens *int64 `json:"max_context_window_tokens,omitempty"` + MaxOutputTokens *int64 `json:"max_output_tokens,omitempty"` + MaxPromptTokens *int64 `json:"max_prompt_tokens,omitempty"` + Vision *ModelCapabilitiesOverrideLimitsVision `json:"vision,omitempty"` } type ModelCapabilitiesOverrideLimitsVision struct { // Maximum image size in bytes - MaxPromptImageSize *int64 `json:"max_prompt_image_size,omitempty"` + MaxPromptImageSize *int64 `json:"max_prompt_image_size,omitempty"` // Maximum number of images per prompt - MaxPromptImages *int64 `json:"max_prompt_images,omitempty"` + MaxPromptImages *int64 `json:"max_prompt_images,omitempty"` // MIME types the model accepts - SupportedMediaTypes []string `json:"supported_media_types,omitempty"` + SupportedMediaTypes []string `json:"supported_media_types,omitempty"` } // Feature flags indicating what the model supports @@ -753,37 +773,37 @@ type ModelCapabilitiesOverrideSupports struct { type ModelList struct { // List of available models with full metadata - Models []ModelElement `json:"models"` + Models []ModelElement `json:"models"` } type ModelSwitchToRequest struct { // Override individual model capabilities resolved by the runtime - ModelCapabilities *ModelCapabilitiesOverride `json:"modelCapabilities,omitempty"` + ModelCapabilities *ModelCapabilitiesOverride `json:"modelCapabilities,omitempty"` // Model identifier to switch to - ModelID string `json:"modelId"` + ModelID string `json:"modelId"` // Reasoning effort level to use for the model - ReasoningEffort *string `json:"reasoningEffort,omitempty"` + ReasoningEffort *string `json:"reasoningEffort,omitempty"` } type ModelSwitchToResult struct { // Currently active model identifier after the switch - ModelID *string `json:"modelId,omitempty"` + ModelID *string `json:"modelId,omitempty"` } type ModelsListRequest struct { // GitHub token for per-user model listing. When provided, resolves this token to determine // the user's Copilot plan and available models instead of using the global auth. - GitHubToken *string `json:"gitHubToken,omitempty"` + GitHubToken *string `json:"gitHubToken,omitempty"` } type NameGetResult struct { - // The session name, falling back to the auto-generated summary, or null if neither exists - Name *string `json:"name"` + // The session name (user-set or auto-generated), or null if not yet set + Name *string `json:"name"` } type NameSetRequest struct { // New session name (1–100 characters, trimmed of leading/trailing whitespace) - Name string `json:"name"` + Name string `json:"name"` } type NameSetResult struct { @@ -799,24 +819,24 @@ type PermissionDecision struct { // Denied by the user during an interactive prompt // // Denied because user confirmation was unavailable - Kind PermissionDecisionKind `json:"kind"` + Kind PermissionDecisionKind `json:"kind"` // The approval to add as a session-scoped rule // // The approval to persist for this location - Approval *PermissionDecisionApproveForLocationApproval `json:"approval,omitempty"` + Approval *PermissionDecisionApproveForLocationApproval `json:"approval,omitempty"` // The location key (git root or cwd) to persist the approval to - LocationKey *string `json:"locationKey,omitempty"` + LocationKey *string `json:"locationKey,omitempty"` // Optional feedback from the user explaining the denial - Feedback *string `json:"feedback,omitempty"` + Feedback *string `json:"feedback,omitempty"` } type PermissionDecisionApproveForLocation struct { // The approval to persist for this location - Approval PermissionDecisionApproveForLocationApproval `json:"approval"` + Approval PermissionDecisionApproveForLocationApproval `json:"approval"` // Approved and persisted for this project location - Kind PermissionDecisionApproveForLocationKind `json:"kind"` + Kind PermissionDecisionApproveForLocationKind `json:"kind"` // The location key (git root or cwd) to persist the approval to - LocationKey string `json:"locationKey"` + LocationKey string `json:"locationKey"` } // The approval to persist for this location @@ -862,9 +882,9 @@ type PermissionDecisionApproveForLocationApprovalWrite struct { type PermissionDecisionApproveForSession struct { // The approval to add as a session-scoped rule - Approval PermissionDecisionApproveForSessionApproval `json:"approval"` + Approval PermissionDecisionApproveForSessionApproval `json:"approval"` // Approved and remembered for the rest of the session - Kind PermissionDecisionApproveForSessionKind `json:"kind"` + Kind PermissionDecisionApproveForSessionKind `json:"kind"` } // The approval to add as a session-scoped rule @@ -910,30 +930,30 @@ type PermissionDecisionApproveForSessionApprovalWrite struct { type PermissionDecisionApproveOnce struct { // The permission request was approved for this one instance - Kind PermissionDecisionApproveOnceKind `json:"kind"` + Kind PermissionDecisionApproveOnceKind `json:"kind"` } type PermissionDecisionReject struct { // Optional feedback from the user explaining the denial - Feedback *string `json:"feedback,omitempty"` + Feedback *string `json:"feedback,omitempty"` // Denied by the user during an interactive prompt - Kind PermissionDecisionRejectKind `json:"kind"` + Kind PermissionDecisionRejectKind `json:"kind"` } type PermissionDecisionRequest struct { // Request ID of the pending permission request - RequestID string `json:"requestId"` - Result PermissionDecision `json:"result"` + RequestID string `json:"requestId"` + Result PermissionDecision `json:"result"` } type PermissionDecisionUserNotAvailable struct { // Denied because user confirmation was unavailable - Kind PermissionDecisionUserNotAvailableKind `json:"kind"` + Kind PermissionDecisionUserNotAvailableKind `json:"kind"` } type PermissionRequestResult struct { // Whether the permission request was handled successfully - Success bool `json:"success"` + Success bool `json:"success"` } type PermissionsResetSessionApprovalsRequest struct { @@ -941,31 +961,31 @@ type PermissionsResetSessionApprovalsRequest struct { type PermissionsResetSessionApprovalsResult struct { // Whether the operation succeeded - Success bool `json:"success"` + Success bool `json:"success"` } type PermissionsSetApproveAllRequest struct { // Whether to auto-approve all tool permission requests - Enabled bool `json:"enabled"` + Enabled bool `json:"enabled"` } type PermissionsSetApproveAllResult struct { // Whether the operation succeeded - Success bool `json:"success"` + Success bool `json:"success"` } type PingRequest struct { // Optional message to echo back - Message *string `json:"message,omitempty"` + Message *string `json:"message,omitempty"` } type PingResult struct { // Echoed message (or default greeting) - Message string `json:"message"` + Message string `json:"message"` // Server protocol version number - ProtocolVersion int64 `json:"protocolVersion"` + ProtocolVersion int64 `json:"protocolVersion"` // Server timestamp in milliseconds - Timestamp int64 `json:"timestamp"` + Timestamp int64 `json:"timestamp"` } type PlanDeleteResult struct { @@ -973,16 +993,16 @@ type PlanDeleteResult struct { type PlanReadResult struct { // The content of the plan file, or null if it does not exist - Content *string `json:"content"` + Content *string `json:"content"` // Whether the plan file exists in the workspace - Exists bool `json:"exists"` + Exists bool `json:"exists"` // Absolute file path of the plan file, or null if workspace is not enabled - Path *string `json:"path"` + Path *string `json:"path"` } type PlanUpdateRequest struct { // The new content for the plan file - Content string `json:"content"` + Content string `json:"content"` } type PlanUpdateResult struct { @@ -990,281 +1010,281 @@ type PlanUpdateResult struct { type PluginElement struct { // Whether the plugin is currently enabled - Enabled bool `json:"enabled"` + Enabled bool `json:"enabled"` // Marketplace the plugin came from - Marketplace string `json:"marketplace"` + Marketplace string `json:"marketplace"` // Plugin name - Name string `json:"name"` + Name string `json:"name"` // Installed version - Version *string `json:"version,omitempty"` + Version *string `json:"version,omitempty"` } // Experimental: PluginList is part of an experimental API and may change or be removed. type PluginList struct { // Installed plugins - Plugins []PluginElement `json:"plugins"` + Plugins []PluginElement `json:"plugins"` } type ServerSkill struct { // Description of what the skill does - Description string `json:"description"` + Description string `json:"description"` // Whether the skill is currently enabled (based on global config) - Enabled bool `json:"enabled"` + Enabled bool `json:"enabled"` // Unique identifier for the skill - Name string `json:"name"` + Name string `json:"name"` // Absolute path to the skill file - Path *string `json:"path,omitempty"` + Path *string `json:"path,omitempty"` // The project path this skill belongs to (only for project/inherited skills) - ProjectPath *string `json:"projectPath,omitempty"` + ProjectPath *string `json:"projectPath,omitempty"` // Source location type (e.g., project, personal-copilot, plugin, builtin) - Source string `json:"source"` + Source string `json:"source"` // Whether the skill can be invoked by the user as a slash command - UserInvocable bool `json:"userInvocable"` + UserInvocable bool `json:"userInvocable"` } type ServerSkillList struct { // All discovered skills across all sources - Skills []ServerSkill `json:"skills"` + Skills []ServerSkill `json:"skills"` } type SessionAuthStatus struct { // Authentication type - AuthType *AuthInfoType `json:"authType,omitempty"` + AuthType *AuthInfoType `json:"authType,omitempty"` // Copilot plan tier (e.g., individual_pro, business) - CopilotPlan *string `json:"copilotPlan,omitempty"` + CopilotPlan *string `json:"copilotPlan,omitempty"` // Authentication host URL - Host *string `json:"host,omitempty"` + Host *string `json:"host,omitempty"` // Whether the session has resolved authentication - IsAuthenticated bool `json:"isAuthenticated"` + IsAuthenticated bool `json:"isAuthenticated"` // Authenticated login/username, if available - Login *string `json:"login,omitempty"` + Login *string `json:"login,omitempty"` // Human-readable authentication status description - StatusMessage *string `json:"statusMessage,omitempty"` + StatusMessage *string `json:"statusMessage,omitempty"` } type SessionFSAppendFileRequest struct { // Content to append - Content string `json:"content"` + Content string `json:"content"` // Optional POSIX-style mode for newly created files - Mode *int64 `json:"mode,omitempty"` + Mode *int64 `json:"mode,omitempty"` // Path using SessionFs conventions - Path string `json:"path"` + Path string `json:"path"` // Target session identifier - SessionID string `json:"sessionId"` + SessionID string `json:"sessionId"` } // Describes a filesystem error. type SessionFSError struct { // Error classification - Code SessionFSErrorCode `json:"code"` + Code SessionFSErrorCode `json:"code"` // Free-form detail about the error, for logging/diagnostics - Message *string `json:"message,omitempty"` + Message *string `json:"message,omitempty"` } type SessionFSExistsRequest struct { // Path using SessionFs conventions - Path string `json:"path"` + Path string `json:"path"` // Target session identifier - SessionID string `json:"sessionId"` + SessionID string `json:"sessionId"` } type SessionFSExistsResult struct { // Whether the path exists - Exists bool `json:"exists"` + Exists bool `json:"exists"` } type SessionFSMkdirRequest struct { // Optional POSIX-style mode for newly created directories - Mode *int64 `json:"mode,omitempty"` + Mode *int64 `json:"mode,omitempty"` // Path using SessionFs conventions - Path string `json:"path"` + Path string `json:"path"` // Create parent directories as needed - Recursive *bool `json:"recursive,omitempty"` + Recursive *bool `json:"recursive,omitempty"` // Target session identifier - SessionID string `json:"sessionId"` + SessionID string `json:"sessionId"` } type SessionFSReadFileRequest struct { // Path using SessionFs conventions - Path string `json:"path"` + Path string `json:"path"` // Target session identifier - SessionID string `json:"sessionId"` + SessionID string `json:"sessionId"` } type SessionFSReadFileResult struct { // File content as UTF-8 string - Content string `json:"content"` + Content string `json:"content"` // Describes a filesystem error. - Error *SessionFSError `json:"error,omitempty"` + Error *SessionFSError `json:"error,omitempty"` } type SessionFSReaddirRequest struct { // Path using SessionFs conventions - Path string `json:"path"` + Path string `json:"path"` // Target session identifier - SessionID string `json:"sessionId"` + SessionID string `json:"sessionId"` } type SessionFSReaddirResult struct { // Entry names in the directory - Entries []string `json:"entries"` + Entries []string `json:"entries"` // Describes a filesystem error. - Error *SessionFSError `json:"error,omitempty"` + Error *SessionFSError `json:"error,omitempty"` } type SessionFSReaddirWithTypesEntry struct { // Entry name - Name string `json:"name"` + Name string `json:"name"` // Entry type - Type SessionFSReaddirWithTypesEntryType `json:"type"` + Type SessionFSReaddirWithTypesEntryType `json:"type"` } type SessionFSReaddirWithTypesRequest struct { // Path using SessionFs conventions - Path string `json:"path"` + Path string `json:"path"` // Target session identifier - SessionID string `json:"sessionId"` + SessionID string `json:"sessionId"` } type SessionFSReaddirWithTypesResult struct { // Directory entries with type information - Entries []SessionFSReaddirWithTypesEntry `json:"entries"` + Entries []SessionFSReaddirWithTypesEntry `json:"entries"` // Describes a filesystem error. - Error *SessionFSError `json:"error,omitempty"` + Error *SessionFSError `json:"error,omitempty"` } type SessionFSRenameRequest struct { // Destination path using SessionFs conventions - Dest string `json:"dest"` + Dest string `json:"dest"` // Target session identifier - SessionID string `json:"sessionId"` + SessionID string `json:"sessionId"` // Source path using SessionFs conventions - Src string `json:"src"` + Src string `json:"src"` } type SessionFSRmRequest struct { // Ignore errors if the path does not exist - Force *bool `json:"force,omitempty"` + Force *bool `json:"force,omitempty"` // Path using SessionFs conventions - Path string `json:"path"` + Path string `json:"path"` // Remove directories and their contents recursively - Recursive *bool `json:"recursive,omitempty"` + Recursive *bool `json:"recursive,omitempty"` // Target session identifier - SessionID string `json:"sessionId"` + SessionID string `json:"sessionId"` } type SessionFSSetProviderRequest struct { // Path conventions used by this filesystem - Conventions SessionFSSetProviderConventions `json:"conventions"` + Conventions SessionFSSetProviderConventions `json:"conventions"` // Initial working directory for sessions - InitialCwd string `json:"initialCwd"` + InitialCwd string `json:"initialCwd"` // Path within each session's SessionFs where the runtime stores files for that session - SessionStatePath string `json:"sessionStatePath"` + SessionStatePath string `json:"sessionStatePath"` } type SessionFSSetProviderResult struct { // Whether the provider was set successfully - Success bool `json:"success"` + Success bool `json:"success"` } type SessionFSStatRequest struct { // Path using SessionFs conventions - Path string `json:"path"` + Path string `json:"path"` // Target session identifier - SessionID string `json:"sessionId"` + SessionID string `json:"sessionId"` } type SessionFSStatResult struct { // ISO 8601 timestamp of creation - Birthtime time.Time `json:"birthtime"` + Birthtime time.Time `json:"birthtime"` // Describes a filesystem error. - Error *SessionFSError `json:"error,omitempty"` + Error *SessionFSError `json:"error,omitempty"` // Whether the path is a directory - IsDirectory bool `json:"isDirectory"` + IsDirectory bool `json:"isDirectory"` // Whether the path is a file - IsFile bool `json:"isFile"` + IsFile bool `json:"isFile"` // ISO 8601 timestamp of last modification - Mtime time.Time `json:"mtime"` + Mtime time.Time `json:"mtime"` // File size in bytes - Size int64 `json:"size"` + Size int64 `json:"size"` } type SessionFSWriteFileRequest struct { // Content to write - Content string `json:"content"` + Content string `json:"content"` // Optional POSIX-style mode for newly created files - Mode *int64 `json:"mode,omitempty"` + Mode *int64 `json:"mode,omitempty"` // Path using SessionFs conventions - Path string `json:"path"` + Path string `json:"path"` // Target session identifier - SessionID string `json:"sessionId"` + SessionID string `json:"sessionId"` } // Experimental: SessionsForkRequest is part of an experimental API and may change or be removed. type SessionsForkRequest struct { // Source session ID to fork from - SessionID string `json:"sessionId"` + SessionID string `json:"sessionId"` // Optional event ID boundary. When provided, the fork includes only events before this ID // (exclusive). When omitted, all events are included. - ToEventID *string `json:"toEventId,omitempty"` + ToEventID *string `json:"toEventId,omitempty"` } // Experimental: SessionsForkResult is part of an experimental API and may change or be removed. type SessionsForkResult struct { // The new forked session's ID - SessionID string `json:"sessionId"` + SessionID string `json:"sessionId"` } type ShellExecRequest struct { // Shell command to execute - Command string `json:"command"` + Command string `json:"command"` // Working directory (defaults to session working directory) - Cwd *string `json:"cwd,omitempty"` + Cwd *string `json:"cwd,omitempty"` // Timeout in milliseconds (default: 30000) - Timeout *int64 `json:"timeout,omitempty"` + Timeout *int64 `json:"timeout,omitempty"` } type ShellExecResult struct { // Unique identifier for tracking streamed output - ProcessID string `json:"processId"` + ProcessID string `json:"processId"` } type ShellKillRequest struct { // Process identifier returned by shell.exec - ProcessID string `json:"processId"` + ProcessID string `json:"processId"` // Signal to send (default: SIGTERM) - Signal *ShellKillSignal `json:"signal,omitempty"` + Signal *ShellKillSignal `json:"signal,omitempty"` } type ShellKillResult struct { // Whether the signal was sent successfully - Killed bool `json:"killed"` + Killed bool `json:"killed"` } type Skill struct { // Description of what the skill does - Description string `json:"description"` + Description string `json:"description"` // Whether the skill is currently enabled - Enabled bool `json:"enabled"` + Enabled bool `json:"enabled"` // Unique identifier for the skill - Name string `json:"name"` + Name string `json:"name"` // Absolute path to the skill file - Path *string `json:"path,omitempty"` + Path *string `json:"path,omitempty"` // Source location type (e.g., project, personal, plugin) - Source string `json:"source"` + Source string `json:"source"` // Whether the skill can be invoked by the user as a slash command - UserInvocable bool `json:"userInvocable"` + UserInvocable bool `json:"userInvocable"` } // Experimental: SkillList is part of an experimental API and may change or be removed. type SkillList struct { // Available skills - Skills []Skill `json:"skills"` + Skills []Skill `json:"skills"` } type SkillsConfigSetDisabledSkillsRequest struct { // List of skill names to disable - DisabledSkills []string `json:"disabledSkills"` + DisabledSkills []string `json:"disabledSkills"` } type SkillsConfigSetDisabledSkillsResult struct { @@ -1273,7 +1293,7 @@ type SkillsConfigSetDisabledSkillsResult struct { // Experimental: SkillsDisableRequest is part of an experimental API and may change or be removed. type SkillsDisableRequest struct { // Name of the skill to disable - Name string `json:"name"` + Name string `json:"name"` } // Experimental: SkillsDisableResult is part of an experimental API and may change or be removed. @@ -1282,15 +1302,15 @@ type SkillsDisableResult struct { type SkillsDiscoverRequest struct { // Optional list of project directory paths to scan for project-scoped skills - ProjectPaths []string `json:"projectPaths,omitempty"` + ProjectPaths []string `json:"projectPaths,omitempty"` // Optional list of additional skill directory paths to include - SkillDirectories []string `json:"skillDirectories,omitempty"` + SkillDirectories []string `json:"skillDirectories,omitempty"` } // Experimental: SkillsEnableRequest is part of an experimental API and may change or be removed. type SkillsEnableRequest struct { // Name of the skill to enable - Name string `json:"name"` + Name string `json:"name"` } // Experimental: SkillsEnableResult is part of an experimental API and may change or be removed. @@ -1301,49 +1321,235 @@ type SkillsEnableResult struct { type SkillsReloadResult struct { } +type TaskAgentInfo struct { + // ISO 8601 timestamp when the current active period began + ActiveStartedAt *time.Time `json:"activeStartedAt,omitempty"` + // Accumulated active execution time in milliseconds + ActiveTimeMS *int64 `json:"activeTimeMs,omitempty"` + // Type of agent running this task + AgentType string `json:"agentType"` + // Whether the task is currently in the original sync wait and can be moved to background + // mode. False once it is already backgrounded, idle, finished, or no longer has a + // promotable sync waiter. + CanPromoteToBackground *bool `json:"canPromoteToBackground,omitempty"` + // ISO 8601 timestamp when the task finished + CompletedAt *time.Time `json:"completedAt,omitempty"` + // Short description of the task + Description string `json:"description"` + // Error message when the task failed + Error *string `json:"error,omitempty"` + // How the agent is currently being managed by the runtime + ExecutionMode *TaskInfoExecutionMode `json:"executionMode,omitempty"` + // Unique task identifier + ID string `json:"id"` + // ISO 8601 timestamp when the agent entered idle state + IdleSince *time.Time `json:"idleSince,omitempty"` + // Most recent response text from the agent + LatestResponse *string `json:"latestResponse,omitempty"` + // Model used for the task when specified + Model *string `json:"model,omitempty"` + // Prompt passed to the agent + Prompt string `json:"prompt"` + // Result text from the task when available + Result *string `json:"result,omitempty"` + // ISO 8601 timestamp when the task was started + StartedAt time.Time `json:"startedAt"` + // Current lifecycle status of the task + Status TaskInfoStatus `json:"status"` + // Tool call ID associated with this agent task + ToolCallID string `json:"toolCallId"` + // Task kind + Type TaskAgentInfoType `json:"type"` +} + +type TaskInfo struct { + // ISO 8601 timestamp when the current active period began + ActiveStartedAt *time.Time `json:"activeStartedAt,omitempty"` + // Accumulated active execution time in milliseconds + ActiveTimeMS *int64 `json:"activeTimeMs,omitempty"` + // Type of agent running this task + AgentType *string `json:"agentType,omitempty"` + // Whether the task is currently in the original sync wait and can be moved to background + // mode. False once it is already backgrounded, idle, finished, or no longer has a + // promotable sync waiter. + // + // Whether this shell task can be promoted to background mode + CanPromoteToBackground *bool `json:"canPromoteToBackground,omitempty"` + // ISO 8601 timestamp when the task finished + CompletedAt *time.Time `json:"completedAt,omitempty"` + // Short description of the task + Description string `json:"description"` + // Error message when the task failed + Error *string `json:"error,omitempty"` + // How the agent is currently being managed by the runtime + // + // Whether the shell command is currently sync-waited or background-managed + ExecutionMode *TaskInfoExecutionMode `json:"executionMode,omitempty"` + // Unique task identifier + ID string `json:"id"` + // ISO 8601 timestamp when the agent entered idle state + IdleSince *time.Time `json:"idleSince,omitempty"` + // Most recent response text from the agent + LatestResponse *string `json:"latestResponse,omitempty"` + // Model used for the task when specified + Model *string `json:"model,omitempty"` + // Prompt passed to the agent + Prompt *string `json:"prompt,omitempty"` + // Result text from the task when available + Result *string `json:"result,omitempty"` + // ISO 8601 timestamp when the task was started + StartedAt time.Time `json:"startedAt"` + // Current lifecycle status of the task + Status TaskInfoStatus `json:"status"` + // Tool call ID associated with this agent task + ToolCallID *string `json:"toolCallId,omitempty"` + // Task kind + Type TaskInfoType `json:"type"` + // Whether the shell runs inside a managed PTY session or as an independent background + // process + AttachmentMode *TaskShellInfoAttachmentMode `json:"attachmentMode,omitempty"` + // Command being executed + Command *string `json:"command,omitempty"` + // Path to the detached shell log, when available + LogPath *string `json:"logPath,omitempty"` + // Process ID when available + PID *int64 `json:"pid,omitempty"` +} + +// Experimental: TaskList is part of an experimental API and may change or be removed. +type TaskList struct { + // Currently tracked tasks + Tasks []TaskInfo `json:"tasks"` +} + +type TaskShellInfo struct { + // Whether the shell runs inside a managed PTY session or as an independent background + // process + AttachmentMode TaskShellInfoAttachmentMode `json:"attachmentMode"` + // Whether this shell task can be promoted to background mode + CanPromoteToBackground *bool `json:"canPromoteToBackground,omitempty"` + // Command being executed + Command string `json:"command"` + // ISO 8601 timestamp when the task finished + CompletedAt *time.Time `json:"completedAt,omitempty"` + // Short description of the task + Description string `json:"description"` + // Whether the shell command is currently sync-waited or background-managed + ExecutionMode *TaskInfoExecutionMode `json:"executionMode,omitempty"` + // Unique task identifier + ID string `json:"id"` + // Path to the detached shell log, when available + LogPath *string `json:"logPath,omitempty"` + // Process ID when available + PID *int64 `json:"pid,omitempty"` + // ISO 8601 timestamp when the task was started + StartedAt time.Time `json:"startedAt"` + // Current lifecycle status of the task + Status TaskInfoStatus `json:"status"` + // Task kind + Type TaskShellInfoType `json:"type"` +} + +// Experimental: TasksCancelRequest is part of an experimental API and may change or be removed. +type TasksCancelRequest struct { + // Task identifier + ID string `json:"id"` +} + +// Experimental: TasksCancelResult is part of an experimental API and may change or be removed. +type TasksCancelResult struct { + // Whether the task was successfully cancelled + Cancelled bool `json:"cancelled"` +} + +// Experimental: TasksPromoteToBackgroundRequest is part of an experimental API and may change or be removed. +type TasksPromoteToBackgroundRequest struct { + // Task identifier + ID string `json:"id"` +} + +// Experimental: TasksPromoteToBackgroundResult is part of an experimental API and may change or be removed. +type TasksPromoteToBackgroundResult struct { + // Whether the task was successfully promoted to background mode + Promoted bool `json:"promoted"` +} + +// Experimental: TasksRemoveRequest is part of an experimental API and may change or be removed. +type TasksRemoveRequest struct { + // Task identifier + ID string `json:"id"` +} + +// Experimental: TasksRemoveResult is part of an experimental API and may change or be removed. +type TasksRemoveResult struct { + // Whether the task was removed. Returns false if the task does not exist or is still + // running/idle (cancel it first). + Removed bool `json:"removed"` +} + +// Experimental: TasksStartAgentRequest is part of an experimental API and may change or be removed. +type TasksStartAgentRequest struct { + // Type of agent to start (e.g., 'explore', 'task', 'general-purpose') + AgentType string `json:"agentType"` + // Short description of the task + Description *string `json:"description,omitempty"` + // Optional model override + Model *string `json:"model,omitempty"` + // Short name for the agent, used to generate a human-readable ID + Name string `json:"name"` + // Task prompt for the agent + Prompt string `json:"prompt"` +} + +// Experimental: TasksStartAgentResult is part of an experimental API and may change or be removed. +type TasksStartAgentResult struct { + // Generated agent ID for the background task + AgentID string `json:"agentId"` +} + type Tool struct { // Description of what the tool does - Description string `json:"description"` + Description string `json:"description"` // Optional instructions for how to use this tool effectively - Instructions *string `json:"instructions,omitempty"` + Instructions *string `json:"instructions,omitempty"` // Tool identifier (e.g., "bash", "grep", "str_replace_editor") - Name string `json:"name"` + Name string `json:"name"` // Optional namespaced name for declarative filtering (e.g., "playwright/navigate" for MCP // tools) - NamespacedName *string `json:"namespacedName,omitempty"` + NamespacedName *string `json:"namespacedName,omitempty"` // JSON Schema for the tool's input parameters - Parameters map[string]any `json:"parameters,omitempty"` + Parameters map[string]any `json:"parameters,omitempty"` } type ToolCallResult struct { // Error message if the tool call failed - Error *string `json:"error,omitempty"` + Error *string `json:"error,omitempty"` // Type of the tool result - ResultType *string `json:"resultType,omitempty"` + ResultType *string `json:"resultType,omitempty"` // Text result to send back to the LLM - TextResultForLlm string `json:"textResultForLlm"` + TextResultForLlm string `json:"textResultForLlm"` // Telemetry data from tool execution - ToolTelemetry map[string]any `json:"toolTelemetry,omitempty"` + ToolTelemetry map[string]any `json:"toolTelemetry,omitempty"` } type ToolList struct { // List of available built-in tools with metadata - Tools []Tool `json:"tools"` + Tools []Tool `json:"tools"` } type ToolsHandlePendingToolCallRequest struct { // Error message if the tool call failed - Error *string `json:"error,omitempty"` + Error *string `json:"error,omitempty"` // Request ID of the pending tool call - RequestID string `json:"requestId"` + RequestID string `json:"requestId"` // Tool call result (string or expanded result object) - Result *ToolsHandlePendingToolCall `json:"result"` + Result *ToolsHandlePendingToolCall `json:"result"` } type ToolsListRequest struct { // Optional model ID — when provided, the returned tool list reflects model-specific // overrides - Model *string `json:"model,omitempty"` + Model *string `json:"model,omitempty"` } type UIElicitationArrayAnyOfField struct { @@ -1382,19 +1588,19 @@ type UIElicitationArrayEnumFieldItems struct { type UIElicitationRequest struct { // Message describing what information is needed from the user - Message string `json:"message"` + Message string `json:"message"` // JSON Schema describing the form fields to present to the user - RequestedSchema UIElicitationSchema `json:"requestedSchema"` + RequestedSchema UIElicitationSchema `json:"requestedSchema"` } // JSON Schema describing the form fields to present to the user type UIElicitationSchema struct { // Form field definitions, keyed by field name - Properties map[string]UIElicitationSchemaProperty `json:"properties"` + Properties map[string]UIElicitationSchemaProperty `json:"properties"` // List of required field names - Required []string `json:"required,omitempty"` + Required []string `json:"required,omitempty"` // Schema type indicator (always 'object') - Type UIElicitationSchemaType `json:"type"` + Type UIElicitationSchemaType `json:"type"` } type UIElicitationSchemaProperty struct { @@ -1429,15 +1635,15 @@ type UIElicitationStringOneOfFieldOneOf struct { // The elicitation response (accept with form values, decline, or cancel) type UIElicitationResponse struct { // The user's response: accept (submitted), decline (rejected), or cancel (dismissed) - Action UIElicitationResponseAction `json:"action"` + Action UIElicitationResponseAction `json:"action"` // The form values submitted by the user (present when action is 'accept') - Content map[string]*UIElicitationFieldValue `json:"content,omitempty"` + Content map[string]*UIElicitationFieldValue `json:"content,omitempty"` } type UIElicitationResult struct { // Whether the response was accepted. False if the request was already resolved by another // client. - Success bool `json:"success"` + Success bool `json:"success"` } type UIElicitationSchemaPropertyBoolean struct { @@ -1485,78 +1691,78 @@ type UIElicitationStringOneOfField struct { type UIHandlePendingElicitationRequest struct { // The unique request ID from the elicitation.requested event - RequestID string `json:"requestId"` + RequestID string `json:"requestId"` // The elicitation response (accept with form values, decline, or cancel) - Result UIElicitationResponse `json:"result"` + Result UIElicitationResponse `json:"result"` } // Experimental: UsageGetMetricsResult is part of an experimental API and may change or be removed. type UsageGetMetricsResult struct { // Aggregated code change metrics - CodeChanges UsageMetricsCodeChanges `json:"codeChanges"` + CodeChanges UsageMetricsCodeChanges `json:"codeChanges"` // Currently active model identifier - CurrentModel *string `json:"currentModel,omitempty"` + CurrentModel *string `json:"currentModel,omitempty"` // Input tokens from the most recent main-agent API call - LastCallInputTokens int64 `json:"lastCallInputTokens"` + LastCallInputTokens int64 `json:"lastCallInputTokens"` // Output tokens from the most recent main-agent API call - LastCallOutputTokens int64 `json:"lastCallOutputTokens"` + LastCallOutputTokens int64 `json:"lastCallOutputTokens"` // Per-model token and request metrics, keyed by model identifier - ModelMetrics map[string]UsageMetricsModelMetric `json:"modelMetrics"` + ModelMetrics map[string]UsageMetricsModelMetric `json:"modelMetrics"` // Session start timestamp (epoch milliseconds) - SessionStartTime int64 `json:"sessionStartTime"` + SessionStartTime int64 `json:"sessionStartTime"` // Total time spent in model API calls (milliseconds) - TotalAPIDurationMS float64 `json:"totalApiDurationMs"` + TotalAPIDurationMS float64 `json:"totalApiDurationMs"` // Total user-initiated premium request cost across all models (may be fractional due to // multipliers) - TotalPremiumRequestCost float64 `json:"totalPremiumRequestCost"` + TotalPremiumRequestCost float64 `json:"totalPremiumRequestCost"` // Raw count of user-initiated API requests - TotalUserRequests int64 `json:"totalUserRequests"` + TotalUserRequests int64 `json:"totalUserRequests"` } // Aggregated code change metrics type UsageMetricsCodeChanges struct { // Number of distinct files modified - FilesModifiedCount int64 `json:"filesModifiedCount"` + FilesModifiedCount int64 `json:"filesModifiedCount"` // Total lines of code added - LinesAdded int64 `json:"linesAdded"` + LinesAdded int64 `json:"linesAdded"` // Total lines of code removed - LinesRemoved int64 `json:"linesRemoved"` + LinesRemoved int64 `json:"linesRemoved"` } type UsageMetricsModelMetric struct { // Request count and cost metrics for this model - Requests UsageMetricsModelMetricRequests `json:"requests"` + Requests UsageMetricsModelMetricRequests `json:"requests"` // Token usage metrics for this model - Usage UsageMetricsModelMetricUsage `json:"usage"` + Usage UsageMetricsModelMetricUsage `json:"usage"` } // Request count and cost metrics for this model type UsageMetricsModelMetricRequests struct { // User-initiated premium request cost (with multiplier applied) - Cost float64 `json:"cost"` + Cost float64 `json:"cost"` // Number of API requests made with this model - Count int64 `json:"count"` + Count int64 `json:"count"` } // Token usage metrics for this model type UsageMetricsModelMetricUsage struct { // Total tokens read from prompt cache - CacheReadTokens int64 `json:"cacheReadTokens"` + CacheReadTokens int64 `json:"cacheReadTokens"` // Total tokens written to prompt cache - CacheWriteTokens int64 `json:"cacheWriteTokens"` + CacheWriteTokens int64 `json:"cacheWriteTokens"` // Total input tokens consumed - InputTokens int64 `json:"inputTokens"` + InputTokens int64 `json:"inputTokens"` // Total output tokens produced - OutputTokens int64 `json:"outputTokens"` + OutputTokens int64 `json:"outputTokens"` // Total output tokens used for reasoning - ReasoningTokens *int64 `json:"reasoningTokens,omitempty"` + ReasoningTokens *int64 `json:"reasoningTokens,omitempty"` } type WorkspacesCreateFileRequest struct { // File content to write as a UTF-8 string - Content string `json:"content"` + Content string `json:"content"` // Relative path within the workspace files directory - Path string `json:"path"` + Path string `json:"path"` } type WorkspacesCreateFileResult struct { @@ -1564,7 +1770,7 @@ type WorkspacesCreateFileResult struct { type WorkspacesGetWorkspaceResult struct { // Current workspace metadata, or null if not available - Workspace *WorkspaceClass `json:"workspace"` + Workspace *WorkspaceClass `json:"workspace"` } type WorkspaceClass struct { @@ -1585,34 +1791,35 @@ type WorkspaceClass struct { Summary *string `json:"summary,omitempty"` SummaryCount *int64 `json:"summary_count,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` + UserNamed *bool `json:"user_named,omitempty"` } type WorkspacesListFilesResult struct { // Relative file paths in the workspace files directory - Files []string `json:"files"` + Files []string `json:"files"` } type WorkspacesReadFileRequest struct { // Relative path within the workspace files directory - Path string `json:"path"` + Path string `json:"path"` } type WorkspacesReadFileResult struct { // File content as a UTF-8 string - Content string `json:"content"` + Content string `json:"content"` } // Authentication type type AuthInfoType string const ( - AuthInfoTypeAPIKey AuthInfoType = "api-key" - AuthInfoTypeUser AuthInfoType = "user" - AuthInfoTypeCopilotAPIToken AuthInfoType = "copilot-api-token" - AuthInfoTypeEnv AuthInfoType = "env" - AuthInfoTypeGhCli AuthInfoType = "gh-cli" - AuthInfoTypeHmac AuthInfoType = "hmac" - AuthInfoTypeToken AuthInfoType = "token" + AuthInfoTypeAPIKey AuthInfoType = "api-key" + AuthInfoTypeUser AuthInfoType = "user" + AuthInfoTypeCopilotAPIToken AuthInfoType = "copilot-api-token" + AuthInfoTypeEnv AuthInfoType = "env" + AuthInfoTypeGhCli AuthInfoType = "gh-cli" + AuthInfoTypeHmac AuthInfoType = "hmac" + AuthInfoTypeToken AuthInfoType = "token" ) // Configuration source @@ -1621,10 +1828,10 @@ const ( type MCPServerSource string const ( - MCPServerSourceBuiltin MCPServerSource = "builtin" - MCPServerSourceUser MCPServerSource = "user" - MCPServerSourcePlugin MCPServerSource = "plugin" - MCPServerSourceWorkspace MCPServerSource = "workspace" + MCPServerSourceBuiltin MCPServerSource = "builtin" + MCPServerSourceUser MCPServerSource = "user" + MCPServerSourcePlugin MCPServerSource = "plugin" + MCPServerSourceWorkspace MCPServerSource = "workspace" ) // Server transport type: stdio, http, sse, or memory (local configs are normalized to stdio) @@ -1641,8 +1848,8 @@ const ( type ExtensionSource string const ( - ExtensionSourceUser ExtensionSource = "user" - ExtensionSourceProject ExtensionSource = "project" + ExtensionSourceUser ExtensionSource = "user" + ExtensionSourceProject ExtensionSource = "project" ) // Current status: running, disabled, failed, or starting @@ -1652,7 +1859,7 @@ const ( ExtensionStatusDisabled ExtensionStatus = "disabled" ExtensionStatusFailed ExtensionStatus = "failed" ExtensionStatusRunning ExtensionStatus = "running" - ExtensionStatusStarting ExtensionStatus = "starting" + ExtensionStatusStarting ExtensionStatus = "starting" ) type FilterMappingString string @@ -1667,9 +1874,9 @@ const ( type InstructionsSourcesLocation string const ( - InstructionsSourcesLocationUser InstructionsSourcesLocation = "user" - InstructionsSourcesLocationRepository InstructionsSourcesLocation = "repository" - InstructionsSourcesLocationWorkingDirectory InstructionsSourcesLocation = "working-directory" + InstructionsSourcesLocationUser InstructionsSourcesLocation = "user" + InstructionsSourcesLocationRepository InstructionsSourcesLocation = "repository" + InstructionsSourcesLocationWorkingDirectory InstructionsSourcesLocation = "working-directory" ) // Category of instruction source — used for merge logic @@ -1708,12 +1915,12 @@ const ( type MCPServerStatus string const ( - MCPServerStatusConnected MCPServerStatus = "connected" - MCPServerStatusDisabled MCPServerStatus = "disabled" - MCPServerStatusFailed MCPServerStatus = "failed" - MCPServerStatusNeedsAuth MCPServerStatus = "needs-auth" - MCPServerStatusNotConfigured MCPServerStatus = "not_configured" - MCPServerStatusPending MCPServerStatus = "pending" + MCPServerStatusConnected MCPServerStatus = "connected" + MCPServerStatusDisabled MCPServerStatus = "disabled" + MCPServerStatusFailed MCPServerStatus = "failed" + MCPServerStatusNeedsAuth MCPServerStatus = "needs-auth" + MCPServerStatusNotConfigured MCPServerStatus = "not_configured" + MCPServerStatusPending MCPServerStatus = "pending" ) // Remote transport type. Defaults to "http" when omitted. @@ -1867,6 +2074,55 @@ const ( ShellKillSignalSIGTERM ShellKillSignal = "SIGTERM" ) +// How the agent is currently being managed by the runtime +// +// Whether the shell command is currently sync-waited or background-managed +type TaskInfoExecutionMode string + +const ( + TaskInfoExecutionModeBackground TaskInfoExecutionMode = "background" + TaskInfoExecutionModeSync TaskInfoExecutionMode = "sync" +) + +// Current lifecycle status of the task +type TaskInfoStatus string + +const ( + TaskInfoStatusCancelled TaskInfoStatus = "cancelled" + TaskInfoStatusCompleted TaskInfoStatus = "completed" + TaskInfoStatusIdle TaskInfoStatus = "idle" + TaskInfoStatusFailed TaskInfoStatus = "failed" + TaskInfoStatusRunning TaskInfoStatus = "running" +) + +type TaskAgentInfoType string + +const ( + TaskAgentInfoTypeAgent TaskAgentInfoType = "agent" +) + +// Whether the shell runs inside a managed PTY session or as an independent background +// process +type TaskShellInfoAttachmentMode string + +const ( + TaskShellInfoAttachmentModeAttached TaskShellInfoAttachmentMode = "attached" + TaskShellInfoAttachmentModeDetached TaskShellInfoAttachmentMode = "detached" +) + +type TaskInfoType string + +const ( + TaskInfoTypeAgent TaskInfoType = "agent" + TaskInfoTypeShell TaskInfoType = "shell" +) + +type TaskShellInfoType string + +const ( + TaskShellInfoTypeShell TaskShellInfoType = "shell" +) + type UIElicitationArrayAnyOfFieldType string const ( @@ -1891,8 +2147,8 @@ const ( type UIElicitationSchemaPropertyType string const ( - UIElicitationSchemaPropertyTypeInteger UIElicitationSchemaPropertyType = "integer" - UIElicitationSchemaPropertyTypeNumber UIElicitationSchemaPropertyType = "number" + UIElicitationSchemaPropertyTypeInteger UIElicitationSchemaPropertyType = "integer" + UIElicitationSchemaPropertyTypeNumber UIElicitationSchemaPropertyType = "number" UIElicitationSchemaPropertyTypeArray UIElicitationSchemaPropertyType = "array" UIElicitationSchemaPropertyTypeBoolean UIElicitationSchemaPropertyType = "boolean" UIElicitationSchemaPropertyTypeString UIElicitationSchemaPropertyType = "string" @@ -1936,9 +2192,9 @@ const ( type SessionSyncLevel string const ( - SessionSyncLevelRepoAndUser SessionSyncLevel = "repo_and_user" - SessionSyncLevelLocal SessionSyncLevel = "local" - SessionSyncLevelUser SessionSyncLevel = "user" + SessionSyncLevelRepoAndUser SessionSyncLevel = "repo_and_user" + SessionSyncLevelLocal SessionSyncLevel = "local" + SessionSyncLevelUser SessionSyncLevel = "user" ) type FilterMapping struct { @@ -2160,7 +2416,7 @@ func (a *ServerSessionsApi) Fork(ctx context.Context, params *SessionsForkReques // ServerRpc provides typed server-scoped RPC methods. type ServerRpc struct { - common serverApi // Reuse a single struct instead of allocating one for each service on the heap. + common serverApi // Reuse a single struct instead of allocating one for each service on the heap. Models *ServerModelsApi Tools *ServerToolsApi @@ -2197,7 +2453,7 @@ func NewServerRpc(client *jsonrpc2.Client) *ServerRpc { } type sessionApi struct { - client *jsonrpc2.Client + client *jsonrpc2.Client sessionID string } @@ -2527,6 +2783,94 @@ func (a *AgentApi) Reload(ctx context.Context) (*AgentReloadResult, error) { return &result, nil } +// Experimental: TasksApi contains experimental APIs that may change or be removed. +type TasksApi sessionApi + +func (a *TasksApi) StartAgent(ctx context.Context, params *TasksStartAgentRequest) (*TasksStartAgentResult, error) { + req := map[string]any{"sessionId": a.sessionID} + if params != nil { + req["agentType"] = params.AgentType + req["prompt"] = params.Prompt + req["name"] = params.Name + if params.Description != nil { + req["description"] = *params.Description + } + if params.Model != nil { + req["model"] = *params.Model + } + } + raw, err := a.client.Request("session.tasks.startAgent", req) + if err != nil { + return nil, err + } + var result TasksStartAgentResult + if err := json.Unmarshal(raw, &result); err != nil { + return nil, err + } + return &result, nil +} + +func (a *TasksApi) List(ctx context.Context) (*TaskList, error) { + req := map[string]any{"sessionId": a.sessionID} + raw, err := a.client.Request("session.tasks.list", req) + if err != nil { + return nil, err + } + var result TaskList + if err := json.Unmarshal(raw, &result); err != nil { + return nil, err + } + return &result, nil +} + +func (a *TasksApi) PromoteToBackground(ctx context.Context, params *TasksPromoteToBackgroundRequest) (*TasksPromoteToBackgroundResult, error) { + req := map[string]any{"sessionId": a.sessionID} + if params != nil { + req["id"] = params.ID + } + raw, err := a.client.Request("session.tasks.promoteToBackground", req) + if err != nil { + return nil, err + } + var result TasksPromoteToBackgroundResult + if err := json.Unmarshal(raw, &result); err != nil { + return nil, err + } + return &result, nil +} + +func (a *TasksApi) Cancel(ctx context.Context, params *TasksCancelRequest) (*TasksCancelResult, error) { + req := map[string]any{"sessionId": a.sessionID} + if params != nil { + req["id"] = params.ID + } + raw, err := a.client.Request("session.tasks.cancel", req) + if err != nil { + return nil, err + } + var result TasksCancelResult + if err := json.Unmarshal(raw, &result); err != nil { + return nil, err + } + return &result, nil +} + +func (a *TasksApi) Remove(ctx context.Context, params *TasksRemoveRequest) (*TasksRemoveResult, error) { + req := map[string]any{"sessionId": a.sessionID} + if params != nil { + req["id"] = params.ID + } + raw, err := a.client.Request("session.tasks.remove", req) + if err != nil { + return nil, err + } + var result TasksRemoveResult + if err := json.Unmarshal(raw, &result); err != nil { + return nil, err + } + return &result, nil +} + // Experimental: SkillsApi contains experimental APIs that may change or be removed. type SkillsApi sessionApi @@ -2981,7 +3325,7 @@ func (a *UsageApi) GetMetrics(ctx context.Context) (*UsageGetMetricsResult, erro // SessionRpc provides typed session-scoped RPC methods. type SessionRpc struct { - common sessionApi // Reuse a single struct instead of allocating one for each service on the heap. + common sessionApi // Reuse a single struct instead of allocating one for each service on the heap. Auth *AuthApi Model *ModelApi @@ -2992,6 +3336,7 @@ type SessionRpc struct { Instructions *InstructionsApi Fleet *FleetApi Agent *AgentApi + Tasks *TasksApi Skills *SkillsApi Mcp *McpApi Plugins *PluginsApi @@ -3042,6 +3387,7 @@ func NewSessionRpc(client *jsonrpc2.Client, sessionID string) *SessionRpc { r.Instructions = (*InstructionsApi)(&r.common) r.Fleet = (*FleetApi)(&r.common) r.Agent = (*AgentApi)(&r.common) + r.Tasks = (*TasksApi)(&r.common) r.Skills = (*SkillsApi)(&r.common) r.Mcp = (*McpApi)(&r.common) r.Plugins = (*PluginsApi)(&r.common) diff --git a/nodejs/package-lock.json b/nodejs/package-lock.json index ac03d9a99..d38ec1d6d 100644 --- a/nodejs/package-lock.json +++ b/nodejs/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.8", "license": "MIT", "dependencies": { - "@github/copilot": "^1.0.36-0", + "@github/copilot": "^1.0.39-0", "vscode-jsonrpc": "^8.2.1", "zod": "^4.3.6" }, @@ -663,26 +663,26 @@ } }, "node_modules/@github/copilot": { - "version": "1.0.36-0", - "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.36-0.tgz", - "integrity": "sha512-M1mxNbdRkiQv4qApKgV33jK6AsA3TqlMAtKyaDv9sJzE/kZa4IRUAUrmO+3d3C+ojZa/Yffjy0/6dC6kllhI4g==", + "version": "1.0.39", + "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.39.tgz", + "integrity": "sha512-AY0VPYf6QQm88wUcOav2B36iedWKBUaMegKRxxY2uIHESiU6HueEuQR/n7D3U2UdD0zLox3jFRjYbZAsr2CgkQ==", "license": "SEE LICENSE IN LICENSE.md", "bin": { "copilot": "npm-loader.js" }, "optionalDependencies": { - "@github/copilot-darwin-arm64": "1.0.36-0", - "@github/copilot-darwin-x64": "1.0.36-0", - "@github/copilot-linux-arm64": "1.0.36-0", - "@github/copilot-linux-x64": "1.0.36-0", - "@github/copilot-win32-arm64": "1.0.36-0", - "@github/copilot-win32-x64": "1.0.36-0" + "@github/copilot-darwin-arm64": "1.0.39", + "@github/copilot-darwin-x64": "1.0.39", + "@github/copilot-linux-arm64": "1.0.39", + "@github/copilot-linux-x64": "1.0.39", + "@github/copilot-win32-arm64": "1.0.39", + "@github/copilot-win32-x64": "1.0.39" } }, "node_modules/@github/copilot-darwin-arm64": { - "version": "1.0.36-0", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.36-0.tgz", - "integrity": "sha512-S0/oT9eo2WvjteWjtjougfh6tokq1Upye6tWeTHWq001E2UvrBN69+cQJNcNQUkO2C2AVvoqiI5RJT/E+HDrww==", + "version": "1.0.39", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.39.tgz", + "integrity": "sha512-E8WfNL43NMzMTDDpCiYikaEmYCMAr6mz8LHrJtkaFuVXVkBr/q2NI3hAtwHFy8M11Fac/MeIe3/VEymWwwh3kw==", "cpu": [ "arm64" ], @@ -696,9 +696,9 @@ } }, "node_modules/@github/copilot-darwin-x64": { - "version": "1.0.36-0", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.36-0.tgz", - "integrity": "sha512-msY1h6J2j005HMHxYqXO6Q5rJdqAjkUnnBwne5p3s71EHGekOl5U8GJs1Q2Y287+e9ZKSY68ANt/JB0Gq2ivmA==", + "version": "1.0.39", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.39.tgz", + "integrity": "sha512-0zbC4lDVX7l8Wvq+JSCMjO0xTN69nWLejTBCl3Ev5bP6P+/7wPURcUvZKoHEaXxOULQ3AGj0DwZNAsvvQkA/6Q==", "cpu": [ "x64" ], @@ -712,9 +712,9 @@ } }, "node_modules/@github/copilot-linux-arm64": { - "version": "1.0.36-0", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.36-0.tgz", - "integrity": "sha512-2yIKaU5XdC0xkFXt80pU+Uqr7pU2lHHzcBehzhDHfDeZVNq8jQj61Ka9r9NBjU3W8c3f99ctPMN8gErFnc5L/A==", + "version": "1.0.39", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.39.tgz", + "integrity": "sha512-x88FuByweJlHlAmUZXjq4JlmtqgoM57Fe7nXzQkGr2Y5wnc2EDydBzFYEOlYDSWozQreimaJIm0KEMAA5T8/Fg==", "cpu": [ "arm64" ], @@ -728,9 +728,9 @@ } }, "node_modules/@github/copilot-linux-x64": { - "version": "1.0.36-0", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.36-0.tgz", - "integrity": "sha512-tiEnl40MmEc4uybJ8at9TagmEcMsNHDiqzER72PYAD4mKwWklZ3RAClaVgzQlTxn1tMdNM7gbajyqSivLmo+rA==", + "version": "1.0.39", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.39.tgz", + "integrity": "sha512-ssahg8r7a0VCsHVXPRmFFXx70xNAxaTM2SZfG7qPRfFB2OM8gHrW26F2oikTklDF6D+A2MfSAMpzJLBUZbPnhw==", "cpu": [ "x64" ], @@ -744,9 +744,9 @@ } }, "node_modules/@github/copilot-win32-arm64": { - "version": "1.0.36-0", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.36-0.tgz", - "integrity": "sha512-c6hT1lnl7B44tLJGmyugvqPQ51bIMXtTeCb7Z5riPd4Sv17gsU+gLWewJLddAnu+0XhjzlBsIHv9GUtxGPCgWQ==", + "version": "1.0.39", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.39.tgz", + "integrity": "sha512-hhBWGZQIywbp6MBxlqMX2GSmHqtUAOGwpo9b0igscecL4i0kz89QNasC+mKiN+zFEHP6I8gggOu87XPI17Io8Q==", "cpu": [ "arm64" ], @@ -760,9 +760,9 @@ } }, "node_modules/@github/copilot-win32-x64": { - "version": "1.0.36-0", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.36-0.tgz", - "integrity": "sha512-RJy3RtlX+34denR3+ttBZsbyeaGoA2nlYoEtnijsQquK37on4gTwVavRbvjfVa2pL+aMuKhRD+xdvsUd+Fu4Lg==", + "version": "1.0.39", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.39.tgz", + "integrity": "sha512-0ehlMtBiwKjmfEY3hVZggdn7qrmPMC8ueBQv/b+6UY3SMRS/M/1Y7xkOCwG84NvJsktdSsk3SlQnE2LbkTVpSA==", "cpu": [ "x64" ], diff --git a/nodejs/package.json b/nodejs/package.json index a7caa354a..2c7b12e1f 100644 --- a/nodejs/package.json +++ b/nodejs/package.json @@ -56,7 +56,7 @@ "author": "GitHub", "license": "MIT", "dependencies": { - "@github/copilot": "^1.0.36-0", + "@github/copilot": "^1.0.39-0", "vscode-jsonrpc": "^8.2.1", "zod": "^4.3.6" }, diff --git a/nodejs/src/generated/rpc.ts b/nodejs/src/generated/rpc.ts index 6ee14deed..d792e2aca 100644 --- a/nodejs/src/generated/rpc.ts +++ b/nodejs/src/generated/rpc.ts @@ -171,6 +171,43 @@ export type SessionFsSetProviderConventions = "windows" | "posix"; * via the `definition` "ShellKillSignal". */ export type ShellKillSignal = "SIGTERM" | "SIGKILL" | "SIGINT"; +/** + * Current lifecycle status of the task + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "TaskAgentInfoStatus". + */ +export type TaskAgentInfoStatus = "running" | "idle" | "completed" | "failed" | "cancelled"; +/** + * How the agent is currently being managed by the runtime + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "TaskAgentInfoExecutionMode". + */ +export type TaskAgentInfoExecutionMode = "sync" | "background"; + +export type TaskInfo = TaskAgentInfo | TaskShellInfo; +/** + * Current lifecycle status of the task + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "TaskShellInfoStatus". + */ +export type TaskShellInfoStatus = "running" | "idle" | "completed" | "failed" | "cancelled"; +/** + * Whether the shell runs inside a managed PTY session or as an independent background process + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "TaskShellInfoAttachmentMode". + */ +export type TaskShellInfoAttachmentMode = "attached" | "detached"; +/** + * Whether the shell command is currently sync-waited or background-managed + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "TaskShellInfoExecutionMode". + */ +export type TaskShellInfoExecutionMode = "sync" | "background"; /** * Tool call result (string or expanded result object) * @@ -273,6 +310,10 @@ export interface AgentInfo { * Description of the agent's purpose */ description: string; + /** + * Absolute local file path of the agent definition. Only set for file-based agents loaded from disk; remote agents do not have a path. + */ + path?: string; } /** @experimental */ @@ -901,7 +942,7 @@ export interface ModeSetRequest { export interface NameGetResult { /** - * The session name, falling back to the auto-generated summary, or null if neither exists + * The session name (user-set or auto-generated), or null if not yet set */ name: string | null; } @@ -1562,6 +1603,205 @@ export interface SkillsEnableRequest { name: string; } +export interface TaskAgentInfo { + /** + * Task kind + */ + type: "agent"; + /** + * Unique task identifier + */ + id: string; + /** + * Tool call ID associated with this agent task + */ + toolCallId: string; + /** + * Short description of the task + */ + description: string; + status: TaskAgentInfoStatus; + /** + * ISO 8601 timestamp when the task was started + */ + startedAt: string; + /** + * ISO 8601 timestamp when the task finished + */ + completedAt?: string; + /** + * Accumulated active execution time in milliseconds + */ + activeTimeMs?: number; + /** + * ISO 8601 timestamp when the current active period began + */ + activeStartedAt?: string; + /** + * Error message when the task failed + */ + error?: string; + /** + * Type of agent running this task + */ + agentType: string; + /** + * Prompt passed to the agent + */ + prompt: string; + /** + * Result text from the task when available + */ + result?: string; + /** + * Model used for the task when specified + */ + model?: string; + executionMode?: TaskAgentInfoExecutionMode; + /** + * Whether the task is currently in the original sync wait and can be moved to background mode. False once it is already backgrounded, idle, finished, or no longer has a promotable sync waiter. + */ + canPromoteToBackground?: boolean; + /** + * Most recent response text from the agent + */ + latestResponse?: string; + /** + * ISO 8601 timestamp when the agent entered idle state + */ + idleSince?: string; +} + +export interface TaskShellInfo { + /** + * Task kind + */ + type: "shell"; + /** + * Unique task identifier + */ + id: string; + /** + * Short description of the task + */ + description: string; + status: TaskShellInfoStatus; + /** + * ISO 8601 timestamp when the task was started + */ + startedAt: string; + /** + * ISO 8601 timestamp when the task finished + */ + completedAt?: string; + /** + * Command being executed + */ + command: string; + attachmentMode: TaskShellInfoAttachmentMode; + executionMode?: TaskShellInfoExecutionMode; + /** + * Whether this shell task can be promoted to background mode + */ + canPromoteToBackground?: boolean; + /** + * Path to the detached shell log, when available + */ + logPath?: string; + /** + * Process ID when available + */ + pid?: number; +} + +/** @experimental */ +export interface TaskList { + /** + * Currently tracked tasks + */ + tasks: TaskInfo[]; +} + +/** @experimental */ +export interface TasksCancelRequest { + /** + * Task identifier + */ + id: string; +} + +/** @experimental */ +export interface TasksCancelResult { + /** + * Whether the task was successfully cancelled + */ + cancelled: boolean; +} + +/** @experimental */ +export interface TasksPromoteToBackgroundRequest { + /** + * Task identifier + */ + id: string; +} + +/** @experimental */ +export interface TasksPromoteToBackgroundResult { + /** + * Whether the task was successfully promoted to background mode + */ + promoted: boolean; +} + +/** @experimental */ +export interface TasksRemoveRequest { + /** + * Task identifier + */ + id: string; +} + +/** @experimental */ +export interface TasksRemoveResult { + /** + * Whether the task was removed. Returns false if the task does not exist or is still running/idle (cancel it first). + */ + removed: boolean; +} + +/** @experimental */ +export interface TasksStartAgentRequest { + /** + * Type of agent to start (e.g., 'explore', 'task', 'general-purpose') + */ + agentType: string; + /** + * Task prompt for the agent + */ + prompt: string; + /** + * Short name for the agent, used to generate a human-readable ID + */ + name: string; + /** + * Short description of the task + */ + description?: string; + /** + * Optional model override + */ + model?: string; +} + +/** @experimental */ +export interface TasksStartAgentResult { + /** + * Generated agent ID for the background task + */ + agentId: string; +} + export interface Tool { /** * Tool identifier (e.g., "bash", "grep", "str_replace_editor") @@ -1910,8 +2150,9 @@ export interface WorkspacesGetWorkspaceResult { repository?: string; host_type?: "github" | "ado"; branch?: string; - summary?: string; name?: string; + user_named?: boolean; + summary?: string; summary_count?: number; created_at?: string; updated_at?: string; @@ -2066,6 +2307,19 @@ export function createSessionRpc(connection: MessageConnection, sessionId: strin connection.sendRequest("session.agent.reload", { sessionId }), }, /** @experimental */ + tasks: { + startAgent: async (params: TasksStartAgentRequest): Promise => + connection.sendRequest("session.tasks.startAgent", { sessionId, ...params }), + list: async (): Promise => + connection.sendRequest("session.tasks.list", { sessionId }), + promoteToBackground: async (params: TasksPromoteToBackgroundRequest): Promise => + connection.sendRequest("session.tasks.promoteToBackground", { sessionId, ...params }), + cancel: async (params: TasksCancelRequest): Promise => + connection.sendRequest("session.tasks.cancel", { sessionId, ...params }), + remove: async (params: TasksRemoveRequest): Promise => + connection.sendRequest("session.tasks.remove", { sessionId, ...params }), + }, + /** @experimental */ skills: { list: async (): Promise => connection.sendRequest("session.skills.list", { sessionId }), diff --git a/nodejs/src/generated/session-events.ts b/nodejs/src/generated/session-events.ts index ebaf68a01..5340ad21d 100644 --- a/nodejs/src/generated/session-events.ts +++ b/nodejs/src/generated/session-events.ts @@ -36,6 +36,7 @@ export type SessionEvent = | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantUsageEvent + | ModelCallFailureEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent @@ -121,6 +122,10 @@ export type UserMessageAttachmentGithubReferenceType = "issue" | "pr" | "discuss * Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent. */ export type AssistantMessageToolRequestType = "function" | "custom"; +/** + * Where the failed model call originated + */ +export type ModelCallFailureSource = "top_level" | "subagent" | "mcp_sampling"; /** * A content block within a tool result, which may be text, terminal output, image, audio, or a resource */ @@ -466,6 +471,14 @@ export interface ErrorEvent { * Error details for timeline display including message and optional diagnostic information */ export interface ErrorData { + /** + * Only set on `errorType: "rate_limit"`. When `true`, the runtime will follow this error with an `auto_mode_switch.requested` event (or silently switch if `continueOnAutoMode` is enabled). UI clients can use this flag to suppress duplicate rendering of the rate-limit error when they show their own auto-mode-switch prompt. + */ + eligibleForAutoSwitch?: boolean; + /** + * Fine-grained error code from the upstream provider, when available. For `errorType: "rate_limit"`, this is one of the `RateLimitErrorCode` values (e.g., `"user_weekly_rate_limited"`, `"user_global_rate_limited"`, `"rate_limited"`, `"user_model_rate_limited"`, `"integration_rate_limited"`). + */ + errorCode?: string; /** * Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query") */ @@ -587,6 +600,10 @@ export interface InfoData { * Human-readable informational message for display in the timeline */ message: string; + /** + * Optional actionable tip displayed with this message + */ + tip?: string; /** * Optional URL associated with this message that the user can open in a browser */ @@ -661,6 +678,10 @@ export interface ModelChangeEvent { * Model change details including previous and new model identifiers */ export interface ModelChangeData { + /** + * Reason the change happened, when not user-initiated. Currently `"rate_limit_auto_switch"` for changes triggered by the auto-mode-switch rate-limit recovery path. UI clients can use this to render contextual copy. + */ + cause?: string; /** * Newly selected model identifier */ @@ -2118,6 +2139,61 @@ export interface AssistantUsageQuotaSnapshot { */ usedRequests: number; } +export interface ModelCallFailureEvent { + /** + * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events. + */ + agentId?: string; + data: ModelCallFailureData; + ephemeral: true; + /** + * Unique event identifier (UUID v4), generated when the event is emitted + */ + id: string; + /** + * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event. + */ + parentId: string | null; + /** + * ISO 8601 timestamp when the event was created + */ + timestamp: string; + type: "model.call_failure"; +} +/** + * Failed LLM API call metadata for telemetry + */ +export interface ModelCallFailureData { + /** + * Completion ID from the model provider (e.g., chatcmpl-abc123) + */ + apiCallId?: string; + /** + * Duration of the failed API call in milliseconds + */ + durationMs?: number; + /** + * Raw provider/runtime error message for restricted telemetry + */ + errorMessage?: string; + /** + * What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls + */ + initiator?: string; + /** + * Model identifier used for the failed API call + */ + model?: string; + /** + * GitHub request tracing ID (x-github-request-id header) for server-side log correlation + */ + providerCallId?: string; + source: ModelCallFailureSource; + /** + * HTTP status code from the failed request + */ + statusCode?: number; +} export interface AbortEvent { /** * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events. @@ -3097,7 +3173,7 @@ export interface SystemNotificationNewInboxMessage { */ senderName: string; /** - * Category of the sender (e.g., ambient-agent, plugin, hook) + * Category of the sender (e.g., sidekick-agent, plugin, hook) */ senderType: string; /** @@ -4267,6 +4343,10 @@ export interface AutoModeSwitchRequestedData { * Unique identifier for this request; used to respond via session.respondToAutoModeSwitch() */ requestId: string; + /** + * Seconds until the rate limit resets, when known. Lets clients render a humanized reset time alongside the prompt. + */ + retryAfterSeconds?: number; } export interface AutoModeSwitchCompletedEvent { /** diff --git a/python/copilot/generated/rpc.py b/python/copilot/generated/rpc.py index 00eaae928..397e3166a 100644 --- a/python/copilot/generated/rpc.py +++ b/python/copilot/generated/rpc.py @@ -156,19 +156,27 @@ class AgentInfo: name: str """Unique identifier of the custom agent""" + path: str | None = None + """Absolute local file path of the agent definition. Only set for file-based agents loaded + from disk; remote agents do not have a path. + """ + @staticmethod def from_dict(obj: Any) -> 'AgentInfo': assert isinstance(obj, dict) description = from_str(obj.get("description")) display_name = from_str(obj.get("displayName")) name = from_str(obj.get("name")) - return AgentInfo(description, display_name, name) + path = from_union([from_str, from_none], obj.get("path")) + return AgentInfo(description, display_name, name, path) def to_dict(self) -> dict: result: dict = {} result["description"] = from_str(self.description) result["displayName"] = from_str(self.display_name) result["name"] = from_str(self.name) + if self.path is not None: + result["path"] = from_union([from_str, from_none], self.path) return result # Experimental: this type is part of an experimental API and may change or be removed. @@ -884,7 +892,7 @@ def to_dict(self) -> dict: @dataclass class NameGetResult: name: str | None = None - """The session name, falling back to the auto-generated summary, or null if neither exists""" + """The session name (user-set or auto-generated), or null if not yet set""" @staticmethod def from_dict(obj: Any) -> 'NameGetResult': @@ -1740,6 +1748,200 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) return result +class TaskInfoExecutionMode(Enum): + """How the agent is currently being managed by the runtime + + Whether the shell command is currently sync-waited or background-managed + """ + BACKGROUND = "background" + SYNC = "sync" + +class TaskInfoStatus(Enum): + """Current lifecycle status of the task""" + + CANCELLED = "cancelled" + COMPLETED = "completed" + FAILED = "failed" + IDLE = "idle" + RUNNING = "running" + +class TaskAgentInfoType(Enum): + AGENT = "agent" + +class TaskShellInfoAttachmentMode(Enum): + """Whether the shell runs inside a managed PTY session or as an independent background + process + """ + ATTACHED = "attached" + DETACHED = "detached" + +class TaskInfoType(Enum): + AGENT = "agent" + SHELL = "shell" + +class TaskShellInfoType(Enum): + SHELL = "shell" + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class TasksCancelRequest: + id: str + """Task identifier""" + + @staticmethod + def from_dict(obj: Any) -> 'TasksCancelRequest': + assert isinstance(obj, dict) + id = from_str(obj.get("id")) + return TasksCancelRequest(id) + + def to_dict(self) -> dict: + result: dict = {} + result["id"] = from_str(self.id) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class TasksCancelResult: + cancelled: bool + """Whether the task was successfully cancelled""" + + @staticmethod + def from_dict(obj: Any) -> 'TasksCancelResult': + assert isinstance(obj, dict) + cancelled = from_bool(obj.get("cancelled")) + return TasksCancelResult(cancelled) + + def to_dict(self) -> dict: + result: dict = {} + result["cancelled"] = from_bool(self.cancelled) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class TasksPromoteToBackgroundRequest: + id: str + """Task identifier""" + + @staticmethod + def from_dict(obj: Any) -> 'TasksPromoteToBackgroundRequest': + assert isinstance(obj, dict) + id = from_str(obj.get("id")) + return TasksPromoteToBackgroundRequest(id) + + def to_dict(self) -> dict: + result: dict = {} + result["id"] = from_str(self.id) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class TasksPromoteToBackgroundResult: + promoted: bool + """Whether the task was successfully promoted to background mode""" + + @staticmethod + def from_dict(obj: Any) -> 'TasksPromoteToBackgroundResult': + assert isinstance(obj, dict) + promoted = from_bool(obj.get("promoted")) + return TasksPromoteToBackgroundResult(promoted) + + def to_dict(self) -> dict: + result: dict = {} + result["promoted"] = from_bool(self.promoted) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class TasksRemoveRequest: + id: str + """Task identifier""" + + @staticmethod + def from_dict(obj: Any) -> 'TasksRemoveRequest': + assert isinstance(obj, dict) + id = from_str(obj.get("id")) + return TasksRemoveRequest(id) + + def to_dict(self) -> dict: + result: dict = {} + result["id"] = from_str(self.id) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class TasksRemoveResult: + removed: bool + """Whether the task was removed. Returns false if the task does not exist or is still + running/idle (cancel it first). + """ + + @staticmethod + def from_dict(obj: Any) -> 'TasksRemoveResult': + assert isinstance(obj, dict) + removed = from_bool(obj.get("removed")) + return TasksRemoveResult(removed) + + def to_dict(self) -> dict: + result: dict = {} + result["removed"] = from_bool(self.removed) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class TasksStartAgentRequest: + agent_type: str + """Type of agent to start (e.g., 'explore', 'task', 'general-purpose')""" + + name: str + """Short name for the agent, used to generate a human-readable ID""" + + prompt: str + """Task prompt for the agent""" + + description: str | None = None + """Short description of the task""" + + model: str | None = None + """Optional model override""" + + @staticmethod + def from_dict(obj: Any) -> 'TasksStartAgentRequest': + assert isinstance(obj, dict) + agent_type = from_str(obj.get("agentType")) + name = from_str(obj.get("name")) + prompt = from_str(obj.get("prompt")) + description = from_union([from_str, from_none], obj.get("description")) + model = from_union([from_str, from_none], obj.get("model")) + return TasksStartAgentRequest(agent_type, name, prompt, description, model) + + def to_dict(self) -> dict: + result: dict = {} + result["agentType"] = from_str(self.agent_type) + result["name"] = from_str(self.name) + result["prompt"] = from_str(self.prompt) + if self.description is not None: + result["description"] = from_union([from_str, from_none], self.description) + if self.model is not None: + result["model"] = from_union([from_str, from_none], self.model) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class TasksStartAgentResult: + agent_id: str + """Generated agent ID for the background task""" + + @staticmethod + def from_dict(obj: Any) -> 'TasksStartAgentResult': + assert isinstance(obj, dict) + agent_id = from_str(obj.get("agentId")) + return TasksStartAgentResult(agent_id) + + def to_dict(self) -> dict: + result: dict = {} + result["agentId"] = from_str(self.agent_id) + return result + @dataclass class Tool: description: str @@ -3230,6 +3432,83 @@ def to_dict(self) -> dict: result["skills"] = from_list(lambda x: to_class(Skill, x), self.skills) return result +@dataclass +class TaskShellInfo: + attachment_mode: TaskShellInfoAttachmentMode + """Whether the shell runs inside a managed PTY session or as an independent background + process + """ + command: str + """Command being executed""" + + description: str + """Short description of the task""" + + id: str + """Unique task identifier""" + + started_at: datetime + """ISO 8601 timestamp when the task was started""" + + status: TaskInfoStatus + """Current lifecycle status of the task""" + + type: TaskShellInfoType + """Task kind""" + + can_promote_to_background: bool | None = None + """Whether this shell task can be promoted to background mode""" + + completed_at: datetime | None = None + """ISO 8601 timestamp when the task finished""" + + execution_mode: TaskInfoExecutionMode | None = None + """Whether the shell command is currently sync-waited or background-managed""" + + log_path: str | None = None + """Path to the detached shell log, when available""" + + pid: int | None = None + """Process ID when available""" + + @staticmethod + def from_dict(obj: Any) -> 'TaskShellInfo': + assert isinstance(obj, dict) + attachment_mode = TaskShellInfoAttachmentMode(obj.get("attachmentMode")) + command = from_str(obj.get("command")) + description = from_str(obj.get("description")) + id = from_str(obj.get("id")) + started_at = from_datetime(obj.get("startedAt")) + status = TaskInfoStatus(obj.get("status")) + type = TaskShellInfoType(obj.get("type")) + can_promote_to_background = from_union([from_bool, from_none], obj.get("canPromoteToBackground")) + completed_at = from_union([from_datetime, from_none], obj.get("completedAt")) + execution_mode = from_union([TaskInfoExecutionMode, from_none], obj.get("executionMode")) + log_path = from_union([from_str, from_none], obj.get("logPath")) + pid = from_union([from_int, from_none], obj.get("pid")) + return TaskShellInfo(attachment_mode, command, description, id, started_at, status, type, can_promote_to_background, completed_at, execution_mode, log_path, pid) + + def to_dict(self) -> dict: + result: dict = {} + result["attachmentMode"] = to_enum(TaskShellInfoAttachmentMode, self.attachment_mode) + result["command"] = from_str(self.command) + result["description"] = from_str(self.description) + result["id"] = from_str(self.id) + result["startedAt"] = self.started_at.isoformat() + result["status"] = to_enum(TaskInfoStatus, self.status) + result["type"] = to_enum(TaskShellInfoType, self.type) + if self.can_promote_to_background is not None: + result["canPromoteToBackground"] = from_union([from_bool, from_none], self.can_promote_to_background) + if self.completed_at is not None: + result["completedAt"] = from_union([lambda x: x.isoformat(), from_none], self.completed_at) + if self.execution_mode is not None: + result["executionMode"] = from_union([lambda x: to_enum(TaskInfoExecutionMode, x), from_none], self.execution_mode) + if self.log_path is not None: + result["logPath"] = from_union([from_str, from_none], self.log_path) + if self.pid is not None: + result["pid"] = from_union([from_int, from_none], self.pid) + return result + @dataclass class ToolList: tools: list[Tool] @@ -3560,6 +3839,7 @@ class Workspace: summary: str | None = None summary_count: int | None = None updated_at: datetime | None = None + user_named: bool | None = None @staticmethod def from_dict(obj: Any) -> 'Workspace': @@ -3581,7 +3861,8 @@ def from_dict(obj: Any) -> 'Workspace': summary = from_union([from_str, from_none], obj.get("summary")) summary_count = from_union([from_int, from_none], obj.get("summary_count")) updated_at = from_union([from_datetime, from_none], obj.get("updated_at")) - return Workspace(id, branch, chronicle_sync_dismissed, created_at, cwd, git_root, host_type, mc_last_event_id, mc_session_id, mc_task_id, name, remote_steerable, repository, session_sync_level, summary, summary_count, updated_at) + user_named = from_union([from_bool, from_none], obj.get("user_named")) + return Workspace(id, branch, chronicle_sync_dismissed, created_at, cwd, git_root, host_type, mc_last_event_id, mc_session_id, mc_task_id, name, remote_steerable, repository, session_sync_level, summary, summary_count, updated_at, user_named) def to_dict(self) -> dict: result: dict = {} @@ -3618,6 +3899,8 @@ def to_dict(self) -> dict: result["summary_count"] = from_union([from_int, from_none], self.summary_count) if self.updated_at is not None: result["updated_at"] = from_union([lambda x: x.isoformat(), from_none], self.updated_at) + if self.user_named is not None: + result["user_named"] = from_union([from_bool, from_none], self.user_named) return result @dataclass @@ -4399,6 +4682,281 @@ def to_dict(self) -> dict: result["reasoningEffort"] = from_union([from_str, from_none], self.reasoning_effort) return result +@dataclass +class TaskAgentInfo: + agent_type: str + """Type of agent running this task""" + + description: str + """Short description of the task""" + + id: str + """Unique task identifier""" + + prompt: str + """Prompt passed to the agent""" + + started_at: datetime + """ISO 8601 timestamp when the task was started""" + + status: TaskInfoStatus + """Current lifecycle status of the task""" + + tool_call_id: str + """Tool call ID associated with this agent task""" + + type: TaskAgentInfoType + """Task kind""" + + active_started_at: datetime | None = None + """ISO 8601 timestamp when the current active period began""" + + active_time_ms: int | None = None + """Accumulated active execution time in milliseconds""" + + can_promote_to_background: bool | None = None + """Whether the task is currently in the original sync wait and can be moved to background + mode. False once it is already backgrounded, idle, finished, or no longer has a + promotable sync waiter. + """ + completed_at: datetime | None = None + """ISO 8601 timestamp when the task finished""" + + error: str | None = None + """Error message when the task failed""" + + execution_mode: TaskInfoExecutionMode | None = None + """How the agent is currently being managed by the runtime""" + + idle_since: datetime | None = None + """ISO 8601 timestamp when the agent entered idle state""" + + latest_response: str | None = None + """Most recent response text from the agent""" + + model: str | None = None + """Model used for the task when specified""" + + result: str | None = None + """Result text from the task when available""" + + @staticmethod + def from_dict(obj: Any) -> 'TaskAgentInfo': + assert isinstance(obj, dict) + agent_type = from_str(obj.get("agentType")) + description = from_str(obj.get("description")) + id = from_str(obj.get("id")) + prompt = from_str(obj.get("prompt")) + started_at = from_datetime(obj.get("startedAt")) + status = TaskInfoStatus(obj.get("status")) + tool_call_id = from_str(obj.get("toolCallId")) + type = TaskAgentInfoType(obj.get("type")) + active_started_at = from_union([from_datetime, from_none], obj.get("activeStartedAt")) + active_time_ms = from_union([from_int, from_none], obj.get("activeTimeMs")) + can_promote_to_background = from_union([from_bool, from_none], obj.get("canPromoteToBackground")) + completed_at = from_union([from_datetime, from_none], obj.get("completedAt")) + error = from_union([from_str, from_none], obj.get("error")) + execution_mode = from_union([TaskInfoExecutionMode, from_none], obj.get("executionMode")) + idle_since = from_union([from_datetime, from_none], obj.get("idleSince")) + latest_response = from_union([from_str, from_none], obj.get("latestResponse")) + model = from_union([from_str, from_none], obj.get("model")) + result = from_union([from_str, from_none], obj.get("result")) + return TaskAgentInfo(agent_type, description, id, prompt, started_at, status, tool_call_id, type, active_started_at, active_time_ms, can_promote_to_background, completed_at, error, execution_mode, idle_since, latest_response, model, result) + + def to_dict(self) -> dict: + result: dict = {} + result["agentType"] = from_str(self.agent_type) + result["description"] = from_str(self.description) + result["id"] = from_str(self.id) + result["prompt"] = from_str(self.prompt) + result["startedAt"] = self.started_at.isoformat() + result["status"] = to_enum(TaskInfoStatus, self.status) + result["toolCallId"] = from_str(self.tool_call_id) + result["type"] = to_enum(TaskAgentInfoType, self.type) + if self.active_started_at is not None: + result["activeStartedAt"] = from_union([lambda x: x.isoformat(), from_none], self.active_started_at) + if self.active_time_ms is not None: + result["activeTimeMs"] = from_union([from_int, from_none], self.active_time_ms) + if self.can_promote_to_background is not None: + result["canPromoteToBackground"] = from_union([from_bool, from_none], self.can_promote_to_background) + if self.completed_at is not None: + result["completedAt"] = from_union([lambda x: x.isoformat(), from_none], self.completed_at) + if self.error is not None: + result["error"] = from_union([from_str, from_none], self.error) + if self.execution_mode is not None: + result["executionMode"] = from_union([lambda x: to_enum(TaskInfoExecutionMode, x), from_none], self.execution_mode) + if self.idle_since is not None: + result["idleSince"] = from_union([lambda x: x.isoformat(), from_none], self.idle_since) + if self.latest_response is not None: + result["latestResponse"] = from_union([from_str, from_none], self.latest_response) + if self.model is not None: + result["model"] = from_union([from_str, from_none], self.model) + if self.result is not None: + result["result"] = from_union([from_str, from_none], self.result) + return result + +@dataclass +class TaskInfo: + description: str + """Short description of the task""" + + id: str + """Unique task identifier""" + + started_at: datetime + """ISO 8601 timestamp when the task was started""" + + status: TaskInfoStatus + """Current lifecycle status of the task""" + + type: TaskInfoType + """Task kind""" + + active_started_at: datetime | None = None + """ISO 8601 timestamp when the current active period began""" + + active_time_ms: int | None = None + """Accumulated active execution time in milliseconds""" + + agent_type: str | None = None + """Type of agent running this task""" + + can_promote_to_background: bool | None = None + """Whether the task is currently in the original sync wait and can be moved to background + mode. False once it is already backgrounded, idle, finished, or no longer has a + promotable sync waiter. + + Whether this shell task can be promoted to background mode + """ + completed_at: datetime | None = None + """ISO 8601 timestamp when the task finished""" + + error: str | None = None + """Error message when the task failed""" + + execution_mode: TaskInfoExecutionMode | None = None + """How the agent is currently being managed by the runtime + + Whether the shell command is currently sync-waited or background-managed + """ + idle_since: datetime | None = None + """ISO 8601 timestamp when the agent entered idle state""" + + latest_response: str | None = None + """Most recent response text from the agent""" + + model: str | None = None + """Model used for the task when specified""" + + prompt: str | None = None + """Prompt passed to the agent""" + + result: str | None = None + """Result text from the task when available""" + + tool_call_id: str | None = None + """Tool call ID associated with this agent task""" + + attachment_mode: TaskShellInfoAttachmentMode | None = None + """Whether the shell runs inside a managed PTY session or as an independent background + process + """ + command: str | None = None + """Command being executed""" + + log_path: str | None = None + """Path to the detached shell log, when available""" + + pid: int | None = None + """Process ID when available""" + + @staticmethod + def from_dict(obj: Any) -> 'TaskInfo': + assert isinstance(obj, dict) + description = from_str(obj.get("description")) + id = from_str(obj.get("id")) + started_at = from_datetime(obj.get("startedAt")) + status = TaskInfoStatus(obj.get("status")) + type = TaskInfoType(obj.get("type")) + active_started_at = from_union([from_datetime, from_none], obj.get("activeStartedAt")) + active_time_ms = from_union([from_int, from_none], obj.get("activeTimeMs")) + agent_type = from_union([from_str, from_none], obj.get("agentType")) + can_promote_to_background = from_union([from_bool, from_none], obj.get("canPromoteToBackground")) + completed_at = from_union([from_datetime, from_none], obj.get("completedAt")) + error = from_union([from_str, from_none], obj.get("error")) + execution_mode = from_union([TaskInfoExecutionMode, from_none], obj.get("executionMode")) + idle_since = from_union([from_datetime, from_none], obj.get("idleSince")) + latest_response = from_union([from_str, from_none], obj.get("latestResponse")) + model = from_union([from_str, from_none], obj.get("model")) + prompt = from_union([from_str, from_none], obj.get("prompt")) + result = from_union([from_str, from_none], obj.get("result")) + tool_call_id = from_union([from_str, from_none], obj.get("toolCallId")) + attachment_mode = from_union([TaskShellInfoAttachmentMode, from_none], obj.get("attachmentMode")) + command = from_union([from_str, from_none], obj.get("command")) + log_path = from_union([from_str, from_none], obj.get("logPath")) + pid = from_union([from_int, from_none], obj.get("pid")) + return TaskInfo(description, id, started_at, status, type, active_started_at, active_time_ms, agent_type, can_promote_to_background, completed_at, error, execution_mode, idle_since, latest_response, model, prompt, result, tool_call_id, attachment_mode, command, log_path, pid) + + def to_dict(self) -> dict: + result: dict = {} + result["description"] = from_str(self.description) + result["id"] = from_str(self.id) + result["startedAt"] = self.started_at.isoformat() + result["status"] = to_enum(TaskInfoStatus, self.status) + result["type"] = to_enum(TaskInfoType, self.type) + if self.active_started_at is not None: + result["activeStartedAt"] = from_union([lambda x: x.isoformat(), from_none], self.active_started_at) + if self.active_time_ms is not None: + result["activeTimeMs"] = from_union([from_int, from_none], self.active_time_ms) + if self.agent_type is not None: + result["agentType"] = from_union([from_str, from_none], self.agent_type) + if self.can_promote_to_background is not None: + result["canPromoteToBackground"] = from_union([from_bool, from_none], self.can_promote_to_background) + if self.completed_at is not None: + result["completedAt"] = from_union([lambda x: x.isoformat(), from_none], self.completed_at) + if self.error is not None: + result["error"] = from_union([from_str, from_none], self.error) + if self.execution_mode is not None: + result["executionMode"] = from_union([lambda x: to_enum(TaskInfoExecutionMode, x), from_none], self.execution_mode) + if self.idle_since is not None: + result["idleSince"] = from_union([lambda x: x.isoformat(), from_none], self.idle_since) + if self.latest_response is not None: + result["latestResponse"] = from_union([from_str, from_none], self.latest_response) + if self.model is not None: + result["model"] = from_union([from_str, from_none], self.model) + if self.prompt is not None: + result["prompt"] = from_union([from_str, from_none], self.prompt) + if self.result is not None: + result["result"] = from_union([from_str, from_none], self.result) + if self.tool_call_id is not None: + result["toolCallId"] = from_union([from_str, from_none], self.tool_call_id) + if self.attachment_mode is not None: + result["attachmentMode"] = from_union([lambda x: to_enum(TaskShellInfoAttachmentMode, x), from_none], self.attachment_mode) + if self.command is not None: + result["command"] = from_union([from_str, from_none], self.command) + if self.log_path is not None: + result["logPath"] = from_union([from_str, from_none], self.log_path) + if self.pid is not None: + result["pid"] = from_union([from_int, from_none], self.pid) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class TaskList: + tasks: list[TaskInfo] + """Currently tracked tasks""" + + @staticmethod + def from_dict(obj: Any) -> 'TaskList': + assert isinstance(obj, dict) + tasks = from_list(TaskInfo.from_dict, obj.get("tasks")) + return TaskList(tasks) + + def to_dict(self) -> dict: + result: dict = {} + result["tasks"] = from_list(lambda x: to_class(TaskInfo, x), self.tasks) + return result + @dataclass class RPC: account_get_quota_request: AccountGetQuotaRequest @@ -4552,6 +5110,23 @@ class RPC: skills_disable_request: SkillsDisableRequest skills_discover_request: SkillsDiscoverRequest skills_enable_request: SkillsEnableRequest + task_agent_info: TaskAgentInfo + task_agent_info_execution_mode: TaskInfoExecutionMode + task_agent_info_status: TaskInfoStatus + task_info: TaskInfo + task_list: TaskList + tasks_cancel_request: TasksCancelRequest + tasks_cancel_result: TasksCancelResult + task_shell_info: TaskShellInfo + task_shell_info_attachment_mode: TaskShellInfoAttachmentMode + task_shell_info_execution_mode: TaskInfoExecutionMode + task_shell_info_status: TaskInfoStatus + tasks_promote_to_background_request: TasksPromoteToBackgroundRequest + tasks_promote_to_background_result: TasksPromoteToBackgroundResult + tasks_remove_request: TasksRemoveRequest + tasks_remove_result: TasksRemoveResult + tasks_start_agent_request: TasksStartAgentRequest + tasks_start_agent_result: TasksStartAgentResult tool: Tool tool_call_result: ToolCallResult tool_list: ToolList @@ -4745,6 +5320,23 @@ def from_dict(obj: Any) -> 'RPC': skills_disable_request = SkillsDisableRequest.from_dict(obj.get("SkillsDisableRequest")) skills_discover_request = SkillsDiscoverRequest.from_dict(obj.get("SkillsDiscoverRequest")) skills_enable_request = SkillsEnableRequest.from_dict(obj.get("SkillsEnableRequest")) + task_agent_info = TaskAgentInfo.from_dict(obj.get("TaskAgentInfo")) + task_agent_info_execution_mode = TaskInfoExecutionMode(obj.get("TaskAgentInfoExecutionMode")) + task_agent_info_status = TaskInfoStatus(obj.get("TaskAgentInfoStatus")) + task_info = TaskInfo.from_dict(obj.get("TaskInfo")) + task_list = TaskList.from_dict(obj.get("TaskList")) + tasks_cancel_request = TasksCancelRequest.from_dict(obj.get("TasksCancelRequest")) + tasks_cancel_result = TasksCancelResult.from_dict(obj.get("TasksCancelResult")) + task_shell_info = TaskShellInfo.from_dict(obj.get("TaskShellInfo")) + task_shell_info_attachment_mode = TaskShellInfoAttachmentMode(obj.get("TaskShellInfoAttachmentMode")) + task_shell_info_execution_mode = TaskInfoExecutionMode(obj.get("TaskShellInfoExecutionMode")) + task_shell_info_status = TaskInfoStatus(obj.get("TaskShellInfoStatus")) + tasks_promote_to_background_request = TasksPromoteToBackgroundRequest.from_dict(obj.get("TasksPromoteToBackgroundRequest")) + tasks_promote_to_background_result = TasksPromoteToBackgroundResult.from_dict(obj.get("TasksPromoteToBackgroundResult")) + tasks_remove_request = TasksRemoveRequest.from_dict(obj.get("TasksRemoveRequest")) + tasks_remove_result = TasksRemoveResult.from_dict(obj.get("TasksRemoveResult")) + tasks_start_agent_request = TasksStartAgentRequest.from_dict(obj.get("TasksStartAgentRequest")) + tasks_start_agent_result = TasksStartAgentResult.from_dict(obj.get("TasksStartAgentResult")) tool = Tool.from_dict(obj.get("Tool")) tool_call_result = ToolCallResult.from_dict(obj.get("ToolCallResult")) tool_list = ToolList.from_dict(obj.get("ToolList")) @@ -4783,7 +5375,7 @@ def from_dict(obj: Any) -> 'RPC': workspaces_list_files_result = WorkspacesListFilesResult.from_dict(obj.get("WorkspacesListFilesResult")) workspaces_read_file_request = WorkspacesReadFileRequest.from_dict(obj.get("WorkspacesReadFileRequest")) workspaces_read_file_result = WorkspacesReadFileResult.from_dict(obj.get("WorkspacesReadFileResult")) - return RPC(account_get_quota_request, account_get_quota_result, account_quota_snapshot, agent_get_current_result, agent_info, agent_list, agent_reload_result, agent_select_request, agent_select_result, auth_info_type, commands_handle_pending_command_request, commands_handle_pending_command_result, current_model, discovered_mcp_server, discovered_mcp_server_source, discovered_mcp_server_type, extension, extension_list, extensions_disable_request, extensions_enable_request, extension_source, extension_status, filter_mapping, filter_mapping_string, filter_mapping_value, fleet_start_request, fleet_start_result, handle_tool_call_result, history_compact_context_window, history_compact_result, history_truncate_request, history_truncate_result, instructions_get_sources_result, instructions_sources, instructions_sources_location, instructions_sources_type, log_request, log_result, mcp_config_add_request, mcp_config_disable_request, mcp_config_enable_request, mcp_config_list, mcp_config_remove_request, mcp_config_update_request, mcp_disable_request, mcp_discover_request, mcp_discover_result, mcp_enable_request, mcp_oauth_login_request, mcp_oauth_login_result, mcp_server, mcp_server_config, mcp_server_config_http, mcp_server_config_http_type, mcp_server_config_local, mcp_server_config_local_type, mcp_server_list, mcp_server_source, mcp_server_status, model, model_billing, model_capabilities, model_capabilities_limits, model_capabilities_limits_vision, model_capabilities_override, model_capabilities_override_limits, model_capabilities_override_limits_vision, model_capabilities_override_supports, model_capabilities_supports, model_list, model_policy, models_list_request, model_switch_to_request, model_switch_to_result, mode_set_request, name_get_result, name_set_request, permission_decision, permission_decision_approve_for_location, permission_decision_approve_for_location_approval, permission_decision_approve_for_location_approval_commands, permission_decision_approve_for_location_approval_custom_tool, permission_decision_approve_for_location_approval_mcp, permission_decision_approve_for_location_approval_mcp_sampling, permission_decision_approve_for_location_approval_memory, permission_decision_approve_for_location_approval_read, permission_decision_approve_for_location_approval_write, permission_decision_approve_for_session, permission_decision_approve_for_session_approval, permission_decision_approve_for_session_approval_commands, permission_decision_approve_for_session_approval_custom_tool, permission_decision_approve_for_session_approval_mcp, permission_decision_approve_for_session_approval_mcp_sampling, permission_decision_approve_for_session_approval_memory, permission_decision_approve_for_session_approval_read, permission_decision_approve_for_session_approval_write, permission_decision_approve_once, permission_decision_reject, permission_decision_request, permission_decision_user_not_available, permission_request_result, permissions_reset_session_approvals_request, permissions_reset_session_approvals_result, permissions_set_approve_all_request, permissions_set_approve_all_result, ping_request, ping_result, plan_read_result, plan_update_request, plugin, plugin_list, server_skill, server_skill_list, session_auth_status, session_fs_append_file_request, session_fs_error, session_fs_error_code, session_fs_exists_request, session_fs_exists_result, session_fs_mkdir_request, session_fs_readdir_request, session_fs_readdir_result, session_fs_readdir_with_types_entry, session_fs_readdir_with_types_entry_type, session_fs_readdir_with_types_request, session_fs_readdir_with_types_result, session_fs_read_file_request, session_fs_read_file_result, session_fs_rename_request, session_fs_rm_request, session_fs_set_provider_conventions, session_fs_set_provider_request, session_fs_set_provider_result, session_fs_stat_request, session_fs_stat_result, session_fs_write_file_request, session_log_level, session_mode, sessions_fork_request, sessions_fork_result, shell_exec_request, shell_exec_result, shell_kill_request, shell_kill_result, shell_kill_signal, skill, skill_list, skills_config_set_disabled_skills_request, skills_disable_request, skills_discover_request, skills_enable_request, tool, tool_call_result, tool_list, tools_handle_pending_tool_call, tools_handle_pending_tool_call_request, tools_list_request, ui_elicitation_array_any_of_field, ui_elicitation_array_any_of_field_items, ui_elicitation_array_any_of_field_items_any_of, ui_elicitation_array_enum_field, ui_elicitation_array_enum_field_items, ui_elicitation_field_value, ui_elicitation_request, ui_elicitation_response, ui_elicitation_response_action, ui_elicitation_response_content, ui_elicitation_result, ui_elicitation_schema, ui_elicitation_schema_property, ui_elicitation_schema_property_boolean, ui_elicitation_schema_property_number, ui_elicitation_schema_property_number_type, ui_elicitation_schema_property_string, ui_elicitation_schema_property_string_format, ui_elicitation_string_enum_field, ui_elicitation_string_one_of_field, ui_elicitation_string_one_of_field_one_of, ui_handle_pending_elicitation_request, usage_get_metrics_result, usage_metrics_code_changes, usage_metrics_model_metric, usage_metrics_model_metric_requests, usage_metrics_model_metric_usage, workspaces_create_file_request, workspaces_get_workspace_result, workspaces_list_files_result, workspaces_read_file_request, workspaces_read_file_result) + return RPC(account_get_quota_request, account_get_quota_result, account_quota_snapshot, agent_get_current_result, agent_info, agent_list, agent_reload_result, agent_select_request, agent_select_result, auth_info_type, commands_handle_pending_command_request, commands_handle_pending_command_result, current_model, discovered_mcp_server, discovered_mcp_server_source, discovered_mcp_server_type, extension, extension_list, extensions_disable_request, extensions_enable_request, extension_source, extension_status, filter_mapping, filter_mapping_string, filter_mapping_value, fleet_start_request, fleet_start_result, handle_tool_call_result, history_compact_context_window, history_compact_result, history_truncate_request, history_truncate_result, instructions_get_sources_result, instructions_sources, instructions_sources_location, instructions_sources_type, log_request, log_result, mcp_config_add_request, mcp_config_disable_request, mcp_config_enable_request, mcp_config_list, mcp_config_remove_request, mcp_config_update_request, mcp_disable_request, mcp_discover_request, mcp_discover_result, mcp_enable_request, mcp_oauth_login_request, mcp_oauth_login_result, mcp_server, mcp_server_config, mcp_server_config_http, mcp_server_config_http_type, mcp_server_config_local, mcp_server_config_local_type, mcp_server_list, mcp_server_source, mcp_server_status, model, model_billing, model_capabilities, model_capabilities_limits, model_capabilities_limits_vision, model_capabilities_override, model_capabilities_override_limits, model_capabilities_override_limits_vision, model_capabilities_override_supports, model_capabilities_supports, model_list, model_policy, models_list_request, model_switch_to_request, model_switch_to_result, mode_set_request, name_get_result, name_set_request, permission_decision, permission_decision_approve_for_location, permission_decision_approve_for_location_approval, permission_decision_approve_for_location_approval_commands, permission_decision_approve_for_location_approval_custom_tool, permission_decision_approve_for_location_approval_mcp, permission_decision_approve_for_location_approval_mcp_sampling, permission_decision_approve_for_location_approval_memory, permission_decision_approve_for_location_approval_read, permission_decision_approve_for_location_approval_write, permission_decision_approve_for_session, permission_decision_approve_for_session_approval, permission_decision_approve_for_session_approval_commands, permission_decision_approve_for_session_approval_custom_tool, permission_decision_approve_for_session_approval_mcp, permission_decision_approve_for_session_approval_mcp_sampling, permission_decision_approve_for_session_approval_memory, permission_decision_approve_for_session_approval_read, permission_decision_approve_for_session_approval_write, permission_decision_approve_once, permission_decision_reject, permission_decision_request, permission_decision_user_not_available, permission_request_result, permissions_reset_session_approvals_request, permissions_reset_session_approvals_result, permissions_set_approve_all_request, permissions_set_approve_all_result, ping_request, ping_result, plan_read_result, plan_update_request, plugin, plugin_list, server_skill, server_skill_list, session_auth_status, session_fs_append_file_request, session_fs_error, session_fs_error_code, session_fs_exists_request, session_fs_exists_result, session_fs_mkdir_request, session_fs_readdir_request, session_fs_readdir_result, session_fs_readdir_with_types_entry, session_fs_readdir_with_types_entry_type, session_fs_readdir_with_types_request, session_fs_readdir_with_types_result, session_fs_read_file_request, session_fs_read_file_result, session_fs_rename_request, session_fs_rm_request, session_fs_set_provider_conventions, session_fs_set_provider_request, session_fs_set_provider_result, session_fs_stat_request, session_fs_stat_result, session_fs_write_file_request, session_log_level, session_mode, sessions_fork_request, sessions_fork_result, shell_exec_request, shell_exec_result, shell_kill_request, shell_kill_result, shell_kill_signal, skill, skill_list, skills_config_set_disabled_skills_request, skills_disable_request, skills_discover_request, skills_enable_request, task_agent_info, task_agent_info_execution_mode, task_agent_info_status, task_info, task_list, tasks_cancel_request, tasks_cancel_result, task_shell_info, task_shell_info_attachment_mode, task_shell_info_execution_mode, task_shell_info_status, tasks_promote_to_background_request, tasks_promote_to_background_result, tasks_remove_request, tasks_remove_result, tasks_start_agent_request, tasks_start_agent_result, tool, tool_call_result, tool_list, tools_handle_pending_tool_call, tools_handle_pending_tool_call_request, tools_list_request, ui_elicitation_array_any_of_field, ui_elicitation_array_any_of_field_items, ui_elicitation_array_any_of_field_items_any_of, ui_elicitation_array_enum_field, ui_elicitation_array_enum_field_items, ui_elicitation_field_value, ui_elicitation_request, ui_elicitation_response, ui_elicitation_response_action, ui_elicitation_response_content, ui_elicitation_result, ui_elicitation_schema, ui_elicitation_schema_property, ui_elicitation_schema_property_boolean, ui_elicitation_schema_property_number, ui_elicitation_schema_property_number_type, ui_elicitation_schema_property_string, ui_elicitation_schema_property_string_format, ui_elicitation_string_enum_field, ui_elicitation_string_one_of_field, ui_elicitation_string_one_of_field_one_of, ui_handle_pending_elicitation_request, usage_get_metrics_result, usage_metrics_code_changes, usage_metrics_model_metric, usage_metrics_model_metric_requests, usage_metrics_model_metric_usage, workspaces_create_file_request, workspaces_get_workspace_result, workspaces_list_files_result, workspaces_read_file_request, workspaces_read_file_result) def to_dict(self) -> dict: result: dict = {} @@ -4938,6 +5530,23 @@ def to_dict(self) -> dict: result["SkillsDisableRequest"] = to_class(SkillsDisableRequest, self.skills_disable_request) result["SkillsDiscoverRequest"] = to_class(SkillsDiscoverRequest, self.skills_discover_request) result["SkillsEnableRequest"] = to_class(SkillsEnableRequest, self.skills_enable_request) + result["TaskAgentInfo"] = to_class(TaskAgentInfo, self.task_agent_info) + result["TaskAgentInfoExecutionMode"] = to_enum(TaskInfoExecutionMode, self.task_agent_info_execution_mode) + result["TaskAgentInfoStatus"] = to_enum(TaskInfoStatus, self.task_agent_info_status) + result["TaskInfo"] = to_class(TaskInfo, self.task_info) + result["TaskList"] = to_class(TaskList, self.task_list) + result["TasksCancelRequest"] = to_class(TasksCancelRequest, self.tasks_cancel_request) + result["TasksCancelResult"] = to_class(TasksCancelResult, self.tasks_cancel_result) + result["TaskShellInfo"] = to_class(TaskShellInfo, self.task_shell_info) + result["TaskShellInfoAttachmentMode"] = to_enum(TaskShellInfoAttachmentMode, self.task_shell_info_attachment_mode) + result["TaskShellInfoExecutionMode"] = to_enum(TaskInfoExecutionMode, self.task_shell_info_execution_mode) + result["TaskShellInfoStatus"] = to_enum(TaskInfoStatus, self.task_shell_info_status) + result["TasksPromoteToBackgroundRequest"] = to_class(TasksPromoteToBackgroundRequest, self.tasks_promote_to_background_request) + result["TasksPromoteToBackgroundResult"] = to_class(TasksPromoteToBackgroundResult, self.tasks_promote_to_background_result) + result["TasksRemoveRequest"] = to_class(TasksRemoveRequest, self.tasks_remove_request) + result["TasksRemoveResult"] = to_class(TasksRemoveResult, self.tasks_remove_result) + result["TasksStartAgentRequest"] = to_class(TasksStartAgentRequest, self.tasks_start_agent_request) + result["TasksStartAgentResult"] = to_class(TasksStartAgentResult, self.tasks_start_agent_result) result["Tool"] = to_class(Tool, self.tool) result["ToolCallResult"] = to_class(ToolCallResult, self.tool_call_result) result["ToolList"] = to_class(ToolList, self.tool_list) @@ -5268,6 +5877,36 @@ async def reload(self, *, timeout: float | None = None) -> AgentReloadResult: return AgentReloadResult.from_dict(await self._client.request("session.agent.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) +# Experimental: this API group is experimental and may change or be removed. +class TasksApi: + def __init__(self, client: "JsonRpcClient", session_id: str): + self._client = client + self._session_id = session_id + + async def start_agent(self, params: TasksStartAgentRequest, *, timeout: float | None = None) -> TasksStartAgentResult: + params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} + params_dict["sessionId"] = self._session_id + return TasksStartAgentResult.from_dict(await self._client.request("session.tasks.startAgent", params_dict, **_timeout_kwargs(timeout))) + + async def list(self, *, timeout: float | None = None) -> TaskList: + return TaskList.from_dict(await self._client.request("session.tasks.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def promote_to_background(self, params: TasksPromoteToBackgroundRequest, *, timeout: float | None = None) -> TasksPromoteToBackgroundResult: + params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} + params_dict["sessionId"] = self._session_id + return TasksPromoteToBackgroundResult.from_dict(await self._client.request("session.tasks.promoteToBackground", params_dict, **_timeout_kwargs(timeout))) + + async def cancel(self, params: TasksCancelRequest, *, timeout: float | None = None) -> TasksCancelResult: + params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} + params_dict["sessionId"] = self._session_id + return TasksCancelResult.from_dict(await self._client.request("session.tasks.cancel", params_dict, **_timeout_kwargs(timeout))) + + async def remove(self, params: TasksRemoveRequest, *, timeout: float | None = None) -> TasksRemoveResult: + params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} + params_dict["sessionId"] = self._session_id + return TasksRemoveResult.from_dict(await self._client.request("session.tasks.remove", params_dict, **_timeout_kwargs(timeout))) + + # Experimental: this API group is experimental and may change or be removed. class SkillsApi: def __init__(self, client: "JsonRpcClient", session_id: str): @@ -5472,6 +6111,7 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self.instructions = InstructionsApi(client, session_id) self.fleet = FleetApi(client, session_id) self.agent = AgentApi(client, session_id) + self.tasks = TasksApi(client, session_id) self.skills = SkillsApi(client, session_id) self.mcp = McpApi(client, session_id) self.plugins = PluginsApi(client, session_id) diff --git a/python/copilot/generated/session_events.py b/python/copilot/generated/session_events.py index bebed90d9..6fb5acf31 100644 --- a/python/copilot/generated/session_events.py +++ b/python/copilot/generated/session_events.py @@ -136,6 +136,7 @@ class SessionEventType(Enum): ASSISTANT_MESSAGE_DELTA = "assistant.message_delta" ASSISTANT_TURN_END = "assistant.turn_end" ASSISTANT_USAGE = "assistant.usage" + MODEL_CALL_FAILURE = "model.call_failure" ABORT = "abort" TOOL_USER_REQUESTED = "tool.user_requested" TOOL_EXECUTION_START = "tool.execution_start" @@ -774,15 +775,18 @@ class AutoModeSwitchRequestedData: "Auto mode switch request notification requiring user approval" request_id: str error_code: str | None = None + retry_after_seconds: float | None = None @staticmethod def from_dict(obj: Any) -> "AutoModeSwitchRequestedData": assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) error_code = from_union([from_none, from_str], obj.get("errorCode")) + retry_after_seconds = from_union([from_none, from_float], obj.get("retryAfterSeconds")) return AutoModeSwitchRequestedData( request_id=request_id, error_code=error_code, + retry_after_seconds=retry_after_seconds, ) def to_dict(self) -> dict: @@ -790,6 +794,8 @@ def to_dict(self) -> dict: result["requestId"] = from_str(self.request_id) if self.error_code is not None: result["errorCode"] = from_union([from_none, from_str], self.error_code) + if self.retry_after_seconds is not None: + result["retryAfterSeconds"] = from_union([from_none, to_float], self.retry_after_seconds) return result @@ -1597,6 +1603,60 @@ def to_dict(self) -> dict: return result +@dataclass +class ModelCallFailureData: + "Failed LLM API call metadata for telemetry" + source: ModelCallFailureSource + api_call_id: str | None = None + duration_ms: float | None = None + error_message: str | None = None + initiator: str | None = None + model: str | None = None + provider_call_id: str | None = None + status_code: int | None = None + + @staticmethod + def from_dict(obj: Any) -> "ModelCallFailureData": + assert isinstance(obj, dict) + source = parse_enum(ModelCallFailureSource, obj.get("source")) + api_call_id = from_union([from_none, from_str], obj.get("apiCallId")) + duration_ms = from_union([from_none, from_float], obj.get("durationMs")) + error_message = from_union([from_none, from_str], obj.get("errorMessage")) + initiator = from_union([from_none, from_str], obj.get("initiator")) + model = from_union([from_none, from_str], obj.get("model")) + provider_call_id = from_union([from_none, from_str], obj.get("providerCallId")) + status_code = from_union([from_none, from_int], obj.get("statusCode")) + return ModelCallFailureData( + source=source, + api_call_id=api_call_id, + duration_ms=duration_ms, + error_message=error_message, + initiator=initiator, + model=model, + provider_call_id=provider_call_id, + status_code=status_code, + ) + + def to_dict(self) -> dict: + result: dict = {} + result["source"] = to_enum(ModelCallFailureSource, self.source) + if self.api_call_id is not None: + result["apiCallId"] = from_union([from_none, from_str], self.api_call_id) + if self.duration_ms is not None: + result["durationMs"] = from_union([from_none, to_float], self.duration_ms) + if self.error_message is not None: + result["errorMessage"] = from_union([from_none, from_str], self.error_message) + if self.initiator is not None: + result["initiator"] = from_union([from_none, from_str], self.initiator) + if self.model is not None: + result["model"] = from_union([from_none, from_str], self.model) + if self.provider_call_id is not None: + result["providerCallId"] = from_union([from_none, from_str], self.provider_call_id) + if self.status_code is not None: + result["statusCode"] = from_union([from_none, to_int], self.status_code) + return result + + @dataclass class PendingMessagesModifiedData: "Empty payload; the event signals that the pending message queue has changed" @@ -2298,6 +2358,8 @@ class SessionErrorData: "Error details for timeline display including message and optional diagnostic information" error_type: str message: str + eligible_for_auto_switch: bool | None = None + error_code: str | None = None provider_call_id: str | None = None stack: str | None = None status_code: int | None = None @@ -2308,6 +2370,8 @@ def from_dict(obj: Any) -> "SessionErrorData": assert isinstance(obj, dict) error_type = from_str(obj.get("errorType")) message = from_str(obj.get("message")) + eligible_for_auto_switch = from_union([from_none, from_bool], obj.get("eligibleForAutoSwitch")) + error_code = from_union([from_none, from_str], obj.get("errorCode")) provider_call_id = from_union([from_none, from_str], obj.get("providerCallId")) stack = from_union([from_none, from_str], obj.get("stack")) status_code = from_union([from_none, from_int], obj.get("statusCode")) @@ -2315,6 +2379,8 @@ def from_dict(obj: Any) -> "SessionErrorData": return SessionErrorData( error_type=error_type, message=message, + eligible_for_auto_switch=eligible_for_auto_switch, + error_code=error_code, provider_call_id=provider_call_id, stack=stack, status_code=status_code, @@ -2325,6 +2391,10 @@ def to_dict(self) -> dict: result: dict = {} result["errorType"] = from_str(self.error_type) result["message"] = from_str(self.message) + if self.eligible_for_auto_switch is not None: + result["eligibleForAutoSwitch"] = from_union([from_none, from_bool], self.eligible_for_auto_switch) + if self.error_code is not None: + result["errorCode"] = from_union([from_none, from_str], self.error_code) if self.provider_call_id is not None: result["providerCallId"] = from_union([from_none, from_str], self.provider_call_id) if self.stack is not None: @@ -2427,6 +2497,7 @@ class SessionInfoData: "Informational message for timeline display with categorization" info_type: str message: str + tip: str | None = None url: str | None = None @staticmethod @@ -2434,10 +2505,12 @@ def from_dict(obj: Any) -> "SessionInfoData": assert isinstance(obj, dict) info_type = from_str(obj.get("infoType")) message = from_str(obj.get("message")) + tip = from_union([from_none, from_str], obj.get("tip")) url = from_union([from_none, from_str], obj.get("url")) return SessionInfoData( info_type=info_type, message=message, + tip=tip, url=url, ) @@ -2445,6 +2518,8 @@ def to_dict(self) -> dict: result: dict = {} result["infoType"] = from_str(self.info_type) result["message"] = from_str(self.message) + if self.tip is not None: + result["tip"] = from_union([from_none, from_str], self.tip) if self.url is not None: result["url"] = from_union([from_none, from_str], self.url) return result @@ -2517,6 +2592,7 @@ def to_dict(self) -> dict: class SessionModelChangeData: "Model change details including previous and new model identifiers" new_model: str + cause: str | None = None previous_model: str | None = None previous_reasoning_effort: str | None = None reasoning_effort: str | None = None @@ -2525,11 +2601,13 @@ class SessionModelChangeData: def from_dict(obj: Any) -> "SessionModelChangeData": assert isinstance(obj, dict) new_model = from_str(obj.get("newModel")) + cause = from_union([from_none, from_str], obj.get("cause")) previous_model = from_union([from_none, from_str], obj.get("previousModel")) previous_reasoning_effort = from_union([from_none, from_str], obj.get("previousReasoningEffort")) reasoning_effort = from_union([from_none, from_str], obj.get("reasoningEffort")) return SessionModelChangeData( new_model=new_model, + cause=cause, previous_model=previous_model, previous_reasoning_effort=previous_reasoning_effort, reasoning_effort=reasoning_effort, @@ -2538,6 +2616,8 @@ def from_dict(obj: Any) -> "SessionModelChangeData": def to_dict(self) -> dict: result: dict = {} result["newModel"] = from_str(self.new_model) + if self.cause is not None: + result["cause"] = from_union([from_none, from_str], self.cause) if self.previous_model is not None: result["previousModel"] = from_union([from_none, from_str], self.previous_model) if self.previous_reasoning_effort is not None: @@ -4279,6 +4359,13 @@ class McpServersLoadedServerStatus(Enum): NOT_CONFIGURED = "not_configured" +class ModelCallFailureSource(Enum): + "Where the failed model call originated" + TOP_LEVEL = "top_level" + SUBAGENT = "subagent" + MCP_SAMPLING = "mcp_sampling" + + class PermissionCompletedKind(Enum): "The outcome of the permission request" APPROVED = "approved" @@ -4433,7 +4520,7 @@ class WorkspaceFileChangedOperation(Enum): UPDATE = "update" -SessionEventData = SessionStartData | SessionResumeData | SessionRemoteSteerableChangedData | SessionErrorData | SessionIdleData | SessionTitleChangedData | SessionInfoData | SessionWarningData | SessionModelChangeData | SessionModeChangedData | SessionPlanChangedData | SessionWorkspaceFileChangedData | SessionHandoffData | SessionTruncationData | SessionSnapshotRewindData | SessionShutdownData | SessionContextChangedData | SessionUsageInfoData | SessionCompactionStartData | SessionCompactionCompleteData | SessionTaskCompleteData | UserMessageData | PendingMessagesModifiedData | AssistantTurnStartData | AssistantIntentData | AssistantReasoningData | AssistantReasoningDeltaData | AssistantStreamingDeltaData | AssistantMessageData | AssistantMessageDeltaData | AssistantTurnEndData | AssistantUsageData | AbortData | ToolUserRequestedData | ToolExecutionStartData | ToolExecutionPartialResultData | ToolExecutionProgressData | ToolExecutionCompleteData | SkillInvokedData | SubagentStartedData | SubagentCompletedData | SubagentFailedData | SubagentSelectedData | SubagentDeselectedData | HookStartData | HookEndData | SystemMessageData | SystemNotificationData | PermissionRequestedData | PermissionCompletedData | UserInputRequestedData | UserInputCompletedData | ElicitationRequestedData | ElicitationCompletedData | SamplingRequestedData | SamplingCompletedData | McpOauthRequiredData | McpOauthCompletedData | ExternalToolRequestedData | ExternalToolCompletedData | CommandQueuedData | CommandExecuteData | CommandCompletedData | AutoModeSwitchRequestedData | AutoModeSwitchCompletedData | CommandsChangedData | CapabilitiesChangedData | ExitPlanModeRequestedData | ExitPlanModeCompletedData | SessionToolsUpdatedData | SessionBackgroundTasksChangedData | SessionSkillsLoadedData | SessionCustomAgentsUpdatedData | SessionMcpServersLoadedData | SessionMcpServerStatusChangedData | SessionExtensionsLoadedData | RawSessionEventData | Data +SessionEventData = SessionStartData | SessionResumeData | SessionRemoteSteerableChangedData | SessionErrorData | SessionIdleData | SessionTitleChangedData | SessionInfoData | SessionWarningData | SessionModelChangeData | SessionModeChangedData | SessionPlanChangedData | SessionWorkspaceFileChangedData | SessionHandoffData | SessionTruncationData | SessionSnapshotRewindData | SessionShutdownData | SessionContextChangedData | SessionUsageInfoData | SessionCompactionStartData | SessionCompactionCompleteData | SessionTaskCompleteData | UserMessageData | PendingMessagesModifiedData | AssistantTurnStartData | AssistantIntentData | AssistantReasoningData | AssistantReasoningDeltaData | AssistantStreamingDeltaData | AssistantMessageData | AssistantMessageDeltaData | AssistantTurnEndData | AssistantUsageData | ModelCallFailureData | AbortData | ToolUserRequestedData | ToolExecutionStartData | ToolExecutionPartialResultData | ToolExecutionProgressData | ToolExecutionCompleteData | SkillInvokedData | SubagentStartedData | SubagentCompletedData | SubagentFailedData | SubagentSelectedData | SubagentDeselectedData | HookStartData | HookEndData | SystemMessageData | SystemNotificationData | PermissionRequestedData | PermissionCompletedData | UserInputRequestedData | UserInputCompletedData | ElicitationRequestedData | ElicitationCompletedData | SamplingRequestedData | SamplingCompletedData | McpOauthRequiredData | McpOauthCompletedData | ExternalToolRequestedData | ExternalToolCompletedData | CommandQueuedData | CommandExecuteData | CommandCompletedData | AutoModeSwitchRequestedData | AutoModeSwitchCompletedData | CommandsChangedData | CapabilitiesChangedData | ExitPlanModeRequestedData | ExitPlanModeCompletedData | SessionToolsUpdatedData | SessionBackgroundTasksChangedData | SessionSkillsLoadedData | SessionCustomAgentsUpdatedData | SessionMcpServersLoadedData | SessionMcpServerStatusChangedData | SessionExtensionsLoadedData | RawSessionEventData | Data @dataclass @@ -4489,6 +4576,7 @@ def from_dict(obj: Any) -> "SessionEvent": case SessionEventType.ASSISTANT_MESSAGE_DELTA: data = AssistantMessageDeltaData.from_dict(data_obj) case SessionEventType.ASSISTANT_TURN_END: data = AssistantTurnEndData.from_dict(data_obj) case SessionEventType.ASSISTANT_USAGE: data = AssistantUsageData.from_dict(data_obj) + case SessionEventType.MODEL_CALL_FAILURE: data = ModelCallFailureData.from_dict(data_obj) case SessionEventType.ABORT: data = AbortData.from_dict(data_obj) case SessionEventType.TOOL_USER_REQUESTED: data = ToolUserRequestedData.from_dict(data_obj) case SessionEventType.TOOL_EXECUTION_START: data = ToolExecutionStartData.from_dict(data_obj)