You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -105,14 +110,14 @@ Create a new conversation session.
105
110
-`SessionId` - Custom session ID
106
111
-`Model` - Model to use ("gpt-5", "claude-sonnet-4.5", etc.)
107
112
-`ReasoningEffort` - Reasoning effort level for models that support it ("low", "medium", "high", "xhigh"). Use `ListModelsAsync()` to check which models support this option.
108
-
-`Tools` - Custom tools exposed to the CLI
113
+
-`Tools` - Custom tool declarations exposed to the CLI. Declarations without an invocable `AIFunction` are left pending for manual resolution.
109
114
-`SystemMessage` - System message customization
110
115
-`AvailableTools` - List of tool names to allow
111
116
-`ExcludedTools` - List of tool names to disable
112
117
-`Provider` - Custom API provider configuration (BYOK)
113
118
-`Streaming` - Enable streaming of response chunks (default: false)
114
119
-`InfiniteSessions` - Configure automatic context compaction (see below)
115
-
-`OnPermissionRequest` - **Required.** Handler called before each tool execution to approve or deny it. Use `PermissionHandler.ApproveAll` to allow everything, or provide a custom function for fine-grained control. See [Permission Handling](#permission-handling) section.
120
+
-`OnPermissionRequest` - Optional handler called before each tool execution to approve or deny it. When omitted, permission requests are emitted as events and left pending for manual resolution. Use `PermissionHandler.ApproveAll` to allow everything, or provide a custom function for fine-grained control. See [Permission Handling](#permission-handling) section.
116
121
-`OnUserInputRequest` - Handler for user input requests from the agent (enables ask_user tool). See [User Input Requests](#user-input-requests) section.
117
122
-`Hooks` - Hook handlers for session lifecycle events. See [Session Hooks](#session-hooks) section.
118
123
@@ -122,7 +127,7 @@ Resume an existing session. Returns the session with `WorkspacePath` populated i
122
127
123
128
**ResumeSessionConfig:**
124
129
125
-
-`OnPermissionRequest` - **Required.** Handler called before each tool execution to approve or deny it. See [Permission Handling](#permission-handling) section.
130
+
-`OnPermissionRequest` - Optional handler called before each tool execution to approve or deny it. See [Permission Handling](#permission-handling) section.
@@ -726,7 +731,7 @@ No extra dependencies — uses built-in `System.Diagnostics.Activity`.
726
731
727
732
## Permission Handling
728
733
729
-
An `OnPermissionRequest` handler is **required** whenever you create or resume a session. The handler is called before the agent executes each tool (file writes, shell commands, custom tools, etc.) and must return a decision.
734
+
An `OnPermissionRequest` handler is optional when you create or resume a session. When provided, it is called before the agent executes each tool (file writes, shell commands, custom tools, etc.) and returns a decision. When omitted, permission requests are emitted as events and left pending for the consumer to resolve with the pending permission RPC.
730
735
731
736
### Approve All (simplest)
732
737
@@ -789,7 +794,7 @@ var session = await client.CreateSessionAsync(new SessionConfig
789
794
790
795
### Resuming Sessions
791
796
792
-
Pass `OnPermissionRequest` when resuming a session too — it is required:
797
+
You may pass `OnPermissionRequest` when resuming a session too:
@@ -670,10 +663,9 @@ public async Task<CopilotSession> CreateSessionAsync(SessionConfig config, Cance
670
663
/// Resumes an existing Copilot session with the specified configuration.
671
664
/// </summary>
672
665
/// <param name="sessionId">The ID of the session to resume.</param>
673
-
/// <param name="config">Configuration for the resumed session, including the required <see cref="ResumeSessionConfig.OnPermissionRequest"/> handler.</param>
666
+
/// <param name="config">Configuration for the resumed session.</param>
674
667
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that can be used to cancel the operation.</param>
675
668
/// <returns>A task that resolves to provide the <see cref="CopilotSession"/>.</returns>
676
-
/// <exception cref="ArgumentException">Thrown when <see cref="ResumeSessionConfig.OnPermissionRequest"/> is not set.</exception>
677
669
/// <exception cref="InvalidOperationException">Thrown when the session does not exist or the client is not connected.</exception>
678
670
/// <remarks>
679
671
/// This allows you to continue a previous conversation, maintaining all conversation history.
@@ -697,13 +689,6 @@ public async Task<CopilotSession> ResumeSessionAsync(string sessionId, ResumeSes
697
689
ArgumentNullException.ThrowIfNull(sessionId);
698
690
ArgumentNullException.ThrowIfNull(config);
699
691
700
-
if(config.OnPermissionRequest==null)
701
-
{
702
-
thrownewArgumentException(
703
-
"An OnPermissionRequest handler is required when resuming a session. "+
704
-
"For example, to allow all permissions, use new() { OnPermissionRequest = PermissionHandler.ApproveAll }.");
0 commit comments