feat: add interactive permission prompt UI to Inspector

Add permission request handling to the Inspector UI so users can
Allow, Always Allow, or Reject tool calls that require permissions
instead of having them auto-cancelled. Wires up SDK
onPermissionRequest/respondPermission through App → ChatPanel →
ChatMessages with proper toolCallId-to-pendingId mapping.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nathan Flurry 2026-03-10 16:47:52 -07:00
parent 1720b6d0ba
commit e8ffd78ac0
27 changed files with 812 additions and 563 deletions

View file

@ -515,7 +515,7 @@ describe("Integration: TypeScript SDK flat session API", () => {
await expect(session.send("session/cancel")).rejects.toThrow(
"Use destroySession(sessionId) instead.",
);
await expect(sdk.sendSessionMethod(session.id, "session/cancel", {})).rejects.toThrow(
await expect(sdk.rawSendSessionMethod(session.id, "session/cancel", {})).rejects.toThrow(
"Use destroySession(sessionId) instead.",
);
@ -578,42 +578,6 @@ describe("Integration: TypeScript SDK flat session API", () => {
await sdk.dispose();
});
it("supports permissionMode as a first-class session helper", async () => {
const sdk = await SandboxAgent.connect({
baseUrl,
token,
});
const session = await sdk.createSession({
agent: "mock",
permissionMode: "plan",
});
expect((await session.getModes())?.currentModeId).toBe("plan");
await session.setPermissionMode("normal");
expect((await session.getModes())?.currentModeId).toBe("normal");
await sdk.dispose();
});
it("rejects conflicting mode and permissionMode values", async () => {
const sdk = await SandboxAgent.connect({
baseUrl,
token,
});
await expect(
sdk.createSession({
agent: "mock",
mode: "normal",
permissionMode: "plan",
}),
).rejects.toThrow("conflicting values");
await sdk.dispose();
});
it("setThoughtLevel happy path switches to a valid thought level", async () => {
const sdk = await SandboxAgent.connect({
baseUrl,
@ -674,7 +638,7 @@ describe("Integration: TypeScript SDK flat session API", () => {
const offPermissions = session.onPermissionRequest((request) => {
permissionIds.push(request.id);
const reply = permissionIds.length === 1 ? "reject" : "always";
void session.replyPermission(request.id, reply);
void session.respondPermission(request.id, reply);
});
const offEvents = session.onEvent((event) => {