feat(chat): per-chat permission modes for Claude, Codex and OpenCode
This commit is contained in:
@@ -337,7 +337,18 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
|
||||
kind: 'operator',
|
||||
directory: '/srv/probe',
|
||||
updated_at: '2026-10-21T12:00:00Z',
|
||||
backend: 'claude',
|
||||
mode: 'default',
|
||||
mode_name: 'Ask for permission',
|
||||
};
|
||||
const CHAT_MODES = [
|
||||
{ id: 'default', name: 'Ask for permission', description: 'Ask before edits and commands.' },
|
||||
{ id: 'acceptEdits', name: 'Accept edits', description: 'Make file edits without asking; ask for other actions.' },
|
||||
{ id: 'plan', name: 'Plan', description: 'Explore and plan without changing anything.' },
|
||||
{ id: 'auto', name: 'Auto', description: "Act without asking, with Claude Code's safety checks." },
|
||||
{ id: 'bypassPermissions', name: 'Bypass permissions', description: 'Never ask. Everything runs without checks.' },
|
||||
];
|
||||
const chatModeRequests = [];
|
||||
|
||||
const dropConnections = () => {
|
||||
for (const connection of connections) connection.close();
|
||||
@@ -394,6 +405,7 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
|
||||
.writeHead(200, { 'content-type': 'application/json' })
|
||||
.end(JSON.stringify({
|
||||
subscribed,
|
||||
chatModeRequests,
|
||||
live,
|
||||
connections: connections.size,
|
||||
refuse,
|
||||
@@ -550,6 +562,23 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
|
||||
setTimeout(() => client.send({ id: request.id, type: 'chat_prompt', chat_queued: chatRunning }), 300);
|
||||
return;
|
||||
}
|
||||
if (request.type === 'chat_modes') {
|
||||
client.send({ id: request.id, type: 'chat_modes', chat_modes: CHAT_MODES,
|
||||
chat_mode: { session_id: CHAT_SESSION.id, mode: CHAT_SESSION.mode } });
|
||||
return;
|
||||
}
|
||||
if (request.type === 'chat_mode') {
|
||||
const mode = CHAT_MODES.find((entry) => entry.id === request.chat_mode?.mode);
|
||||
chatModeRequests.push(request.chat_mode);
|
||||
if (!mode) {
|
||||
client.send({ id: request.id, type: 'error', error: 'unknown Claude permission mode' });
|
||||
return;
|
||||
}
|
||||
CHAT_SESSION.mode = mode.id;
|
||||
CHAT_SESSION.mode_name = mode.name;
|
||||
client.send({ id: request.id, type: 'chat_mode', chat_mode: { session_id: CHAT_SESSION.id, mode: mode.id } });
|
||||
return;
|
||||
}
|
||||
if (request.type === 'chat_shells') {
|
||||
client.send({ id: request.id, type: 'chat_shells', chat_shells: [] });
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user