feat: ClawTap v0.2.0

Interactive Prompts:
- Unified InteractivePrompt type across all 3 adapters (Claude/Codex/Gemini)
- InteractivePromptOverlay component with options, text input, countdown
- Gemini + Codex pane monitors detect tool confirmation, ask user, plan approval
- respondInteractivePrompt routing: permission → respondPermission, options → _selectOption
- Claude AskUserQuestion nested questions[0] structure parsing

Cross-AI Review:
- Client-generated reviewId, removed pendingReview state
- FloatingReviewPanel uses CSS display:none instead of unmount (keeps hooks alive)
- Child review sessions default to YOLO/bypass permission mode
- Send back to parent, send to existing/new review, tab switching, end review
- Collapsed review cards with read-only panel for ended reviews
- Full reconnect support: active + ended reviews restore correctly

AskUserQuestion Tool Card UI:
- Dedicated renderer replaces raw JSON display
- Options shown with selected (green) / unselected (gray) indicators
- Free text answers shown in quoted format with green border
- Collapsed summary: question → answer
- Shared parseAskQuestionInput utility (client + server)
- Historical tool results attached via _result on tool_use blocks

Adapter Fixes:
- Session→adapter mapping persisted in SQLite (survives server restart)
- SESSION_CREATED deferred for pendingRekey adapters (Codex/Gemini)
- session-rekeyed handler sends complete SESSION_CREATED with adapter + cwd
- Gemini: auto-accept folder trust, privacy notice, IDE nudge, YOLO * prompt
- Claude: auto-accept bypass permissions confirmation (v2.1.85+)
- Port fallback (EADDRINUSE → try +1), statusLine shell script wrapper

Other:
- Desktop Enter sends / Shift+Enter newline; Mobile Enter newline
- Strip CLAWTAP_REF marker from session list
- Active sessions tab shows adapter badge
- Rename CLAUDE_UI_PASSWORD → CLAWTAP_PASSWORD

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
kuannnn
2026-03-27 14:46:00 +08:00
parent 16f75379af
commit 0fcf66fc22
50 changed files with 2179 additions and 400 deletions
+39
View File
@@ -611,6 +611,28 @@ export class TmuxAdapter extends EventEmitter {
}
}
respondInteractivePrompt(requestId: string, selectedOption?: string, textValue?: string): void {
if (textValue != null) {
this.respondQuestion(requestId, textValue);
} else if (selectedOption != null) {
// Permission behaviors are named ('allow', 'allow_session', 'deny')
// Question options are numeric indices ('0', '1', '2')
const isPermission = ['allow', 'allow_session', 'deny'].includes(selectedOption);
if (isPermission) {
this.respondPermission(requestId, selectedOption as any);
} else {
// Numeric index — validate before consuming the pending entry
const index = parseInt(selectedOption);
if (isNaN(index)) return;
const pending = this._permissions.resolveQuestion(requestId);
if (!pending) return;
const session = this.sessions.get(pending.sessionId);
if (!session) return;
this._selectOption(session.windowId, index).catch(() => {});
}
}
}
/**
* Respond to the CLI's plan approval selector.
* Options: 0=bypass (auto-accept edits), 1=manually approve, 2=text feedback
@@ -876,6 +898,23 @@ export class TmuxAdapter extends EventEmitter {
if (attempt <= 3 || attempt % 5 === 0) {
console.log(`[adapter] waitForReady #${attempt}: window=${windowId} prompt=${hasPrompt} lines=${lineCount}`);
}
// Auto-accept bypass permissions confirmation prompt (Claude v2.1.85+).
// Detect by structure (numbered selection list) + context (bypass permissions).
const isSelectionPrompt = /\s+\d+\./.test(content);
const isBypassPrompt = /[Bb]ypass\s+[Pp]ermissions/.test(content);
if (isSelectionPrompt && isBypassPrompt) {
const acceptMatch = content.match(/(\d+)\.\s+Yes/);
const acceptOption = acceptMatch ? parseInt(acceptMatch[1]) : 2;
console.log(`[adapter] Bypass permissions prompt detected, selecting option ${acceptOption}`);
for (let i = 1; i < acceptOption; i++) {
await tmuxManager.sendControl(windowId, 'Down');
await new Promise<void>(r => setTimeout(r, 50));
}
await tmuxManager.sendControl(windowId, 'Enter');
await new Promise<void>(r => setTimeout(r, 500));
continue;
}
if (hasPrompt && lineCount >= 3) {
console.log(`[adapter] CLI ready for ${windowId} in ${Date.now() - start}ms`);
await new Promise<void>(r => setTimeout(r, 300));