0fcf66fc22
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>
80 lines
2.3 KiB
TypeScript
80 lines
2.3 KiB
TypeScript
import fs from 'fs';
|
|
import path from 'path';
|
|
import os from 'os';
|
|
|
|
const CLAWTAP_DIR = path.join(os.homedir(), '.clawtap');
|
|
|
|
export interface AppConfig {
|
|
password: string;
|
|
port: number;
|
|
clawtapDir: string;
|
|
https: { cert: Buffer; key: Buffer } | null;
|
|
transcription: { provider: 'whisper'; apiKey: string } | null;
|
|
gitBranch: string;
|
|
paths: {
|
|
auth: string;
|
|
vapidKeys: string;
|
|
pushSubs: string;
|
|
pid: string;
|
|
uploads: string;
|
|
db: string;
|
|
};
|
|
}
|
|
|
|
export function loadConfig(): AppConfig {
|
|
const password = process.env.CLAWTAP_PASSWORD;
|
|
if (!password) {
|
|
throw new Error(
|
|
'CLAWTAP_PASSWORD is required.\n' +
|
|
'Set it and try again:\n' +
|
|
' export CLAWTAP_PASSWORD=your-password'
|
|
);
|
|
}
|
|
|
|
const port = parseInt(process.env.PORT || '', 10) || 3456;
|
|
|
|
const certPath = path.join(CLAWTAP_DIR, 'cert.pem');
|
|
const keyPath = path.join(CLAWTAP_DIR, 'key.pem');
|
|
const httpsConfig = (fs.existsSync(certPath) && fs.existsSync(keyPath))
|
|
? { cert: fs.readFileSync(certPath), key: fs.readFileSync(keyPath) }
|
|
: null;
|
|
|
|
const transcription = process.env.OPENAI_API_KEY
|
|
? { provider: 'whisper' as const, apiKey: process.env.OPENAI_API_KEY }
|
|
: null;
|
|
|
|
const config: AppConfig = {
|
|
password,
|
|
port,
|
|
clawtapDir: CLAWTAP_DIR,
|
|
https: httpsConfig,
|
|
transcription,
|
|
gitBranch: process.env.GIT_BRANCH || 'unknown',
|
|
paths: {
|
|
auth: path.join(os.homedir(), '.clawtap-auth.json'),
|
|
vapidKeys: path.join(CLAWTAP_DIR, 'vapid-keys.json'),
|
|
pushSubs: path.join(CLAWTAP_DIR, 'push-subscriptions.json'),
|
|
pid: path.join(CLAWTAP_DIR, 'server.pid'),
|
|
uploads: path.join(os.tmpdir(), 'clawtap-uploads'),
|
|
db: path.join(CLAWTAP_DIR, 'clawtap.db'),
|
|
},
|
|
};
|
|
|
|
printFeatureStatus(config);
|
|
return config;
|
|
}
|
|
|
|
function printFeatureStatus(config: AppConfig): void {
|
|
const features: [string, string][] = [
|
|
['HTTPS', config.https ? '✓ enabled' : '✗ disabled (no certs)'],
|
|
['Voice Transcription', config.transcription ? `✓ ${config.transcription.provider}` : '✗ disabled (no OPENAI_API_KEY)'],
|
|
['Port', String(config.port)],
|
|
];
|
|
|
|
console.log('\n ClawTap Configuration:');
|
|
for (const [name, status] of features) {
|
|
console.log(` ${name}: ${status}`);
|
|
}
|
|
console.log('');
|
|
}
|