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
+18 -2
View File
@@ -139,6 +139,7 @@ export async function getMessages(sessionId: string, dir?: string): Promise<GetM
try {
const messages: unknown[] = [];
const subToolMap: Map<string, SubToolBlock[]> = new Map(); // parentToolUseId → sub-tool blocks
const toolUseIndex: Map<string, ContentBlock> = new Map(); // tool_use id → content block
const stream = createReadStream(filePath);
const rl = createInterface({ input: stream, crlfDelay: Infinity });
try {
@@ -162,9 +163,24 @@ export async function getMessages(sessionId: string, dir?: string): Promise<GetM
if (entry.type === 'assistant') {
if (isNoResponseMessage(text)) continue;
messages.push(entry.message);
// Index tool_use blocks for O(1) result attachment
if (Array.isArray(content)) {
for (const block of content as ContentBlock[]) {
if (block.type === 'tool_use' && block.id) toolUseIndex.set(block.id, block);
}
}
} else if (entry.type === 'user') {
// Skip messages containing tool results (not needed for display)
if (Array.isArray(content) && content.some((b: ContentBlock) => b.type === 'tool_result')) continue;
// Attach tool results to their matching tool_use blocks
const toolResults = Array.isArray(content)
? (content as ContentBlock[]).filter((b: ContentBlock) => b.type === 'tool_result' && b.tool_use_id)
: [];
if (toolResults.length > 0) {
for (const block of toolResults) {
const match = toolUseIndex.get(block.tool_use_id as string);
if (match) match._result = block;
}
continue;
}
// Skip system/CLI messages (empty text, system patterns)
if (isSystemMessage(text, content)) continue;
// Convert "Implement the following plan:" messages to plan type