mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-05 06:59:42 +02:00
fix: restrict auto-accept to plan mode only, block AskUserQuestion prompts
The auto-accept feature was too aggressive - it would press Enter for any silence without a completion message, including AskUserQuestion prompts. Now uses the elicitation_dialog notification hook to detect when Claude is asking a question, and blocks auto-accept in that case. Only plan mode approvals (silence with no completion message AND no elicitation signal) trigger auto-accept. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -888,7 +888,7 @@ class ClaudemanApp {
|
||||
this.eventSource.addEventListener('respawn:autoAcceptSent', (e) => {
|
||||
const data = JSON.parse(e.data);
|
||||
if (data.sessionId === this.activeSessionId) {
|
||||
document.getElementById('respawnStep').textContent = '⏎ Auto-accepted prompt';
|
||||
document.getElementById('respawnStep').textContent = '⏎ Auto-accepted plan';
|
||||
}
|
||||
const session = this.sessions.get(data.sessionId);
|
||||
this.notificationManager?.notify({
|
||||
@@ -896,8 +896,8 @@ class ClaudemanApp {
|
||||
category: 'auto-accept',
|
||||
sessionId: data.sessionId,
|
||||
sessionName: session?.name || data.sessionId?.slice(0, 8),
|
||||
title: 'Auto-Accepted',
|
||||
message: `Accepted prompt for ${session?.name || 'session'}`,
|
||||
title: 'Plan Accepted',
|
||||
message: `Accepted plan mode for ${session?.name || 'session'}`,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -338,11 +338,11 @@
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<label>Auto-Accept Prompts</label>
|
||||
<label>Auto-Accept Plan Mode</label>
|
||||
<div class="checkbox-group-inline">
|
||||
<label class="checkbox-inline">
|
||||
<input type="checkbox" id="modalRespawnAutoAccept" checked onchange="app.autoSaveRespawnConfig()">
|
||||
<span>Accept plan mode & questions</span>
|
||||
<span>Accept plan mode approvals</span>
|
||||
</label>
|
||||
</div>
|
||||
<span class="form-hint">Presses Enter to accept plan approvals and default question options when Claude is waiting</span>
|
||||
|
||||
+10
-1
@@ -1460,13 +1460,22 @@ export class WebServer extends EventEmitter {
|
||||
|
||||
this.app.post('/api/hook-event', async (req) => {
|
||||
const { event, sessionId } = req.body as HookEventRequest;
|
||||
const validEvents = ['idle_prompt', 'permission_prompt', 'stop'] as const;
|
||||
const validEvents = ['idle_prompt', 'permission_prompt', 'elicitation_dialog', 'stop'] as const;
|
||||
if (!event || !validEvents.includes(event as typeof validEvents[number])) {
|
||||
return createErrorResponse(ApiErrorCode.INVALID_INPUT, 'Invalid event type');
|
||||
}
|
||||
if (!sessionId || !this.sessions.has(sessionId)) {
|
||||
return createErrorResponse(ApiErrorCode.NOT_FOUND, 'Session not found');
|
||||
}
|
||||
|
||||
// Signal the respawn controller to block auto-accept for question prompts
|
||||
if (event === 'elicitation_dialog') {
|
||||
const controller = this.respawnControllers.get(sessionId);
|
||||
if (controller) {
|
||||
controller.signalElicitation();
|
||||
}
|
||||
}
|
||||
|
||||
this.broadcast(`hook:${event}`, { sessionId, timestamp: Date.now() });
|
||||
return { success: true };
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user