Skip to content

Commit 03184d2

Browse files
joshspicerSteveSandersonMS
authored andcommitted
Expose managed approval requirement on permission requests
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 18f1bbc1-6001-43e2-b293-724505087f6a
1 parent 523b0c7 commit 03184d2

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

nodejs/src/types.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,9 +1097,15 @@ export type SystemMessageConfig =
10971097
* discriminated union from the runtime schema — switch on `kind` to
10981098
* access the variant-specific fields (e.g. shell `commands`, write
10991099
* `fileName`/`diff`, mcp `toolName`/`args`).
1100+
*
1101+
* `managedApprovalRequired` indicates that managed policy requires an explicit
1102+
* user decision. Hosts should bypass automatic approval and present their
1103+
* normal confirmation UI.
11001104
*/
1101-
export type { PermissionRequest } from "./generated/session-events.js";
1102-
import type { PermissionRequest } from "./generated/session-events.js";
1105+
import type { PermissionRequest as GeneratedPermissionRequest } from "./generated/session-events.js";
1106+
export type PermissionRequest = GeneratedPermissionRequest & {
1107+
readonly managedApprovalRequired?: boolean;
1108+
};
11031109

11041110
import type { PermissionDecisionRequest } from "./generated/rpc.js";
11051111

nodejs/test/session-event-types.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { describe, expect, it } from "vitest";
1818
import type {
1919
// The aggregate union; must still resolve via the package root.
2020
SessionEvent,
21+
PermissionRequest,
2122

2223
// *Data payload types from the v0.3.0 generated session-event schema.
2324
AssistantMessageData,
@@ -103,6 +104,17 @@ describe("Session event type exports (#1156)", () => {
103104
expect(data.turnId).toBe("turn-1");
104105
});
105106

107+
it("exposes whether managed policy requires explicit user approval", () => {
108+
const request: PermissionRequest = {
109+
kind: "read",
110+
path: "/workspace/file.txt",
111+
intention: "Read a file",
112+
managedApprovalRequired: true,
113+
};
114+
115+
expect(request.managedApprovalRequired).toBe(true);
116+
});
117+
106118
it("wraps ToolExecutionStartData inside the exported ToolExecutionStartEvent", () => {
107119
const event: ToolExecutionStartEvent = {
108120
id: "evt-1",

0 commit comments

Comments
 (0)