Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion dotnet/src/Generated/SessionEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ public partial class SessionRemoteSteerableChangedData
/// <summary>Error details for timeline display including message and optional diagnostic information.</summary>
public partial class SessionErrorData
{
/// <summary>Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "query").</summary>
/// <summary>Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query").</summary>
[JsonPropertyName("errorType")]
public required string ErrorType { get; set; }

Expand Down Expand Up @@ -2267,6 +2267,11 @@ public partial class PermissionRequestedData
/// <summary>Details of the permission being requested.</summary>
[JsonPropertyName("permissionRequest")]
public required PermissionRequest PermissionRequest { get; set; }

/// <summary>When true, this permission was already resolved by a permissionRequest hook and requires no client action.</summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("resolvedByHook")]
public bool? ResolvedByHook { get; set; }
}

/// <summary>Permission request completion notification signaling UI dismissal.</summary>
Expand Down Expand Up @@ -2998,6 +3003,11 @@ public partial class AssistantMessageDataToolRequestsItem
[JsonPropertyName("toolTitle")]
public string? ToolTitle { get; set; }

/// <summary>Name of the MCP server hosting this tool, when the tool is an MCP tool.</summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("mcpServerName")]
public string? McpServerName { get; set; }

/// <summary>Resolved intention summary describing what this specific call does.</summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("intentionSummary")]
Expand Down Expand Up @@ -3989,6 +3999,9 @@ public enum PermissionCompletedDataResultKind
/// <summary>The <c>denied-by-content-exclusion-policy</c> variant.</summary>
[JsonStringEnumMemberName("denied-by-content-exclusion-policy")]
DeniedByContentExclusionPolicy,
/// <summary>The <c>denied-by-permission-request-hook</c> variant.</summary>
[JsonStringEnumMemberName("denied-by-permission-request-hook")]
DeniedByPermissionRequestHook,
}

/// <summary>Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent.</summary>
Expand Down
3 changes: 3 additions & 0 deletions dotnet/src/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,9 @@ private async Task HandleBroadcastEventAsync(SessionEvent sessionEvent)
if (string.IsNullOrEmpty(data.RequestId) || data.PermissionRequest is null)
return;

if (data.ResolvedByHook == true)
return; // Already resolved by a permissionRequest hook; no client action needed.

var handler = _permissionHandler;
if (handler is null)
return; // This client doesn't handle permissions; another client will.
Expand Down
8 changes: 7 additions & 1 deletion go/generated_session_events.go

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

12 changes: 7 additions & 5 deletions go/rpc/generated_rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,11 +652,12 @@ type SessionPermissionsHandlePendingPermissionRequestParams struct {
}

type SessionPermissionsHandlePendingPermissionRequestParamsResult struct {
Kind Kind `json:"kind"`
Rules []any `json:"rules,omitempty"`
Feedback *string `json:"feedback,omitempty"`
Message *string `json:"message,omitempty"`
Path *string `json:"path,omitempty"`
Kind Kind `json:"kind"`
Rules []any `json:"rules,omitempty"`
Feedback *string `json:"feedback,omitempty"`
Message *string `json:"message,omitempty"`
Path *string `json:"path,omitempty"`
Interrupt *bool `json:"interrupt,omitempty"`
}

type SessionLogResult struct {
Expand Down Expand Up @@ -815,6 +816,7 @@ type Kind string
const (
KindApproved Kind = "approved"
KindDeniedByContentExclusionPolicy Kind = "denied-by-content-exclusion-policy"
KindDeniedByPermissionRequestHook Kind = "denied-by-permission-request-hook"
KindDeniedByRules Kind = "denied-by-rules"
KindDeniedInteractivelyByUser Kind = "denied-interactively-by-user"
KindDeniedNoApprovalRuleAndCouldNotRequestFromUser Kind = "denied-no-approval-rule-and-could-not-request-from-user"
Expand Down
3 changes: 3 additions & 0 deletions go/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,9 @@ func (s *Session) handleBroadcastEvent(event SessionEvent) {
if requestID == nil || event.Data.PermissionRequest == nil {
return
}
if event.Data.ResolvedByHook != nil && *event.Data.ResolvedByHook {
return // Already resolved by a permissionRequest hook; no client action needed.
}
handler := s.getPermissionHandler()
if handler == nil {
return
Expand Down
56 changes: 28 additions & 28 deletions nodejs/package-lock.json

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

2 changes: 1 addition & 1 deletion nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@github/copilot": "^1.0.15-2",
"@github/copilot": "^1.0.17",
"vscode-jsonrpc": "^8.2.1",
"zod": "^4.3.6"
},
Expand Down
3 changes: 2 additions & 1 deletion nodejs/samples/package-lock.json

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

5 changes: 5 additions & 0 deletions nodejs/src/generated/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,11 @@ export interface SessionPermissionsHandlePendingPermissionRequestParams {
kind: "denied-by-content-exclusion-policy";
path: string;
message: string;
}
| {
kind: "denied-by-permission-request-hook";
message?: string;
interrupt?: boolean;
};
}

Expand Down
13 changes: 11 additions & 2 deletions nodejs/src/generated/session-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export type SessionEvent =
*/
data: {
/**
* Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "query")
* Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query")
*/
errorType: string;
/**
Expand Down Expand Up @@ -1480,6 +1480,10 @@ export type SessionEvent =
* Human-readable display title for the tool
*/
toolTitle?: string;
/**
* Name of the MCP server hosting this tool, when the tool is an MCP tool
*/
mcpServerName?: string;
/**
* Resolved intention summary describing what this specific call does
*/
Expand Down Expand Up @@ -2872,6 +2876,10 @@ export type SessionEvent =
*/
hookMessage?: string;
};
/**
* When true, this permission was already resolved by a permissionRequest hook and requires no client action
*/
resolvedByHook?: boolean;
};
}
| {
Expand Down Expand Up @@ -2909,7 +2917,8 @@ export type SessionEvent =
| "denied-by-rules"
| "denied-no-approval-rule-and-could-not-request-from-user"
| "denied-interactively-by-user"
| "denied-by-content-exclusion-policy";
| "denied-by-content-exclusion-policy"
| "denied-by-permission-request-hook";
};
};
}
Expand Down
6 changes: 5 additions & 1 deletion nodejs/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,14 @@ export class CopilotSession {
);
}
} else if (event.type === "permission.requested") {
const { requestId, permissionRequest } = event.data as {
const { requestId, permissionRequest, resolvedByHook } = event.data as {
requestId: string;
permissionRequest: PermissionRequest;
resolvedByHook?: boolean;
};
if (resolvedByHook) {
return; // Already resolved by a permissionRequest hook; no client action needed.
}
if (this.permissionHandler) {
void this._executePermissionAndRespond(requestId, permissionRequest);
}
Expand Down
7 changes: 6 additions & 1 deletion python/copilot/generated/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2257,6 +2257,7 @@ def to_dict(self) -> dict:
class Kind(Enum):
APPROVED = "approved"
DENIED_BY_CONTENT_EXCLUSION_POLICY = "denied-by-content-exclusion-policy"
DENIED_BY_PERMISSION_REQUEST_HOOK = "denied-by-permission-request-hook"
DENIED_BY_RULES = "denied-by-rules"
DENIED_INTERACTIVELY_BY_USER = "denied-interactively-by-user"
DENIED_NO_APPROVAL_RULE_AND_COULD_NOT_REQUEST_FROM_USER = "denied-no-approval-rule-and-could-not-request-from-user"
Expand All @@ -2269,6 +2270,7 @@ class SessionPermissionsHandlePendingPermissionRequestParamsResult:
feedback: str | None = None
message: str | None = None
path: str | None = None
interrupt: bool | None = None

@staticmethod
def from_dict(obj: Any) -> 'SessionPermissionsHandlePendingPermissionRequestParamsResult':
Expand All @@ -2278,7 +2280,8 @@ def from_dict(obj: Any) -> 'SessionPermissionsHandlePendingPermissionRequestPara
feedback = from_union([from_str, from_none], obj.get("feedback"))
message = from_union([from_str, from_none], obj.get("message"))
path = from_union([from_str, from_none], obj.get("path"))
return SessionPermissionsHandlePendingPermissionRequestParamsResult(kind, rules, feedback, message, path)
interrupt = from_union([from_bool, from_none], obj.get("interrupt"))
return SessionPermissionsHandlePendingPermissionRequestParamsResult(kind, rules, feedback, message, path, interrupt)

def to_dict(self) -> dict:
result: dict = {}
Expand All @@ -2291,6 +2294,8 @@ def to_dict(self) -> dict:
result["message"] = from_union([from_str, from_none], self.message)
if self.path is not None:
result["path"] = from_union([from_str, from_none], self.path)
if self.interrupt is not None:
result["interrupt"] = from_union([from_bool, from_none], self.interrupt)
return result


Expand Down
Loading
Loading