diff --git a/CLAUDE.md b/CLAUDE.md index 84338ca6..9c2b0127 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -38,7 +38,7 @@ Claudeman is a Claude Code session manager with a web interface and autonomous R When adding new features, always ask: "Will this maintain responsiveness with 20 sessions and 50 agent windows?" -**Version**: 0.1393 (must match `package.json`) +**Version**: 0.1394 (must match `package.json`) **Tech Stack**: TypeScript (ES2022/NodeNext, strict mode), Node.js, Fastify, Server-Sent Events, node-pty diff --git a/package.json b/package.json index 8b1e5c7b..60c45d4c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "claudeman", - "version": "0.1393", + "version": "0.1394", "description": "The missing control plane for Claude Code - run 20 autonomous agents with real-time monitoring and session persistence", "type": "module", "main": "dist/index.js", diff --git a/src/session.ts b/src/session.ts index f8bfaa8d..e74194c7 100644 --- a/src/session.ts +++ b/src/session.ts @@ -1202,18 +1202,24 @@ export class Session extends EventEmitter { * the response. * * @param prompt - The prompt text to send to Claude + * @param options - Optional configuration + * @param options.model - Model to use ('opus', 'sonnet', or full model name). Defaults to default model. + * @param options.onProgress - Callback for progress updates (token count, status) * @returns Promise resolving to the result text and total cost in USD * @throws {Error} If a process is already running in this session * * @example * ```typescript * const session = new Session({ workingDir: '/project' }); - * const { result, cost } = await session.runPrompt('Explain this code'); + * const { result, cost } = await session.runPrompt('Explain this code', { model: 'opus' }); * console.log(`Response: ${result}`); * console.log(`Cost: $${cost.toFixed(4)}`); * ``` */ - async runPrompt(prompt: string): Promise<{ result: string; cost: number }> { + async runPrompt( + prompt: string, + options?: { model?: string; onProgress?: (info: { tokens?: number; status?: string }) => void } + ): Promise<{ result: string; cost: number }> { return new Promise((resolve, reject) => { if (this.ptyProcess) { reject(new Error('Session already has a running process')); @@ -1235,14 +1241,20 @@ export class Session extends EventEmitter { try { // Spawn claude in a real PTY - console.log('[Session] Spawning PTY for claude with prompt:', prompt.substring(0, 50)); + const model = options?.model; + console.log('[Session] Spawning PTY for claude with prompt:', prompt.substring(0, 50), model ? `(model: ${model})` : ''); - this.ptyProcess = pty.spawn('claude', [ + const args = [ '-p', '--dangerously-skip-permissions', '--output-format', 'stream-json', - prompt - ], { + ]; + if (model) { + args.push('--model', model); + } + args.push(prompt); + + this.ptyProcess = pty.spawn('claude', args, { name: 'xterm-256color', cols: 120, rows: 40, diff --git a/src/web/public/app.js b/src/web/public/app.js index 40f388ed..ea74e4a7 100644 --- a/src/web/public/app.js +++ b/src/web/public/app.js @@ -2635,34 +2635,67 @@ class ClaudemanApp { async generatePlan() { const config = this.ralphWizardConfig; - // Stop any existing timer + // Stop any existing timers if (this.planLoadingTimer) { clearInterval(this.planLoadingTimer); this.planLoadingTimer = null; } + if (this.planPhaseTimer) { + clearInterval(this.planPhaseTimer); + this.planPhaseTimer = null; + } // Show loading state document.getElementById('planGenerationError')?.classList.add('hidden'); document.getElementById('planEditor')?.classList.add('hidden'); document.getElementById('planGenerationLoading')?.classList.remove('hidden'); - // Start elapsed time display + // Animated progress phases + const phases = [ + { time: 0, title: 'Starting Opus 4.5...', hint: 'Initializing deep reasoning model' }, + { time: 3, title: 'Analyzing task requirements...', hint: 'Understanding the scope and complexity' }, + { time: 8, title: 'Identifying components...', hint: 'Breaking down into modules and features' }, + { time: 15, title: 'Planning TDD approach...', hint: 'Designing test-first implementation strategy' }, + { time: 25, title: 'Generating implementation steps...', hint: 'Creating detailed action items with tests' }, + { time: 40, title: 'Adding verification checkpoints...', hint: 'Ensuring each phase has validation' }, + { time: 55, title: 'Reviewing for completeness...', hint: 'Checking all requirements are covered' }, + { time: 70, title: 'Finalizing plan...', hint: 'Organizing and prioritizing steps' }, + { time: 90, title: 'Still working...', hint: 'Complex tasks take longer - hang tight!' }, + ]; + + // Start elapsed time and phase display this.planLoadingStartTime = Date.now(); const timeEl = document.getElementById('planLoadingTime'); - if (timeEl) timeEl.textContent = '0s'; + const titleEl = document.getElementById('planLoadingTitle'); + const hintEl = document.getElementById('planLoadingHint'); + if (timeEl) timeEl.textContent = '0s'; + if (titleEl) titleEl.textContent = phases[0].title; + if (hintEl) hintEl.textContent = phases[0].hint; + + let currentPhaseIndex = 0; this.planLoadingTimer = setInterval(() => { const elapsed = Math.floor((Date.now() - this.planLoadingStartTime) / 1000); if (timeEl) timeEl.textContent = `${elapsed}s`; + + // Update phase based on elapsed time + for (let i = phases.length - 1; i >= 0; i--) { + if (elapsed >= phases[i].time && i > currentPhaseIndex) { + currentPhaseIndex = i; + if (titleEl) titleEl.textContent = phases[i].title; + if (hintEl) hintEl.textContent = phases[i].hint; + break; + } + } }, 1000); // Determine max items based on detail level const detailConfig = { - brief: { maxItems: 5, includeTests: false }, - standard: { maxItems: 8, includeTests: true }, - detailed: { maxItems: 12, includeTests: true }, + brief: { maxItems: 10 }, + standard: { maxItems: 15 }, + detailed: { maxItems: 20 }, }; - const { maxItems, includeTests } = detailConfig[config.planDetailLevel] || detailConfig.standard; + const { maxItems } = detailConfig[config.planDetailLevel] || detailConfig.standard; try { const res = await fetch('/api/generate-plan', { @@ -2671,7 +2704,6 @@ class ClaudemanApp { body: JSON.stringify({ taskDescription: config.taskDescription, maxItems, - includeTests, detailLevel: config.planDetailLevel, }), }); @@ -2838,6 +2870,16 @@ class ClaudemanApp { } skipPlanGeneration() { + // Stop any running timers + if (this.planLoadingTimer) { + clearInterval(this.planLoadingTimer); + this.planLoadingTimer = null; + } + if (this.planPhaseTimer) { + clearInterval(this.planPhaseTimer); + this.planPhaseTimer = null; + } + this.ralphWizardConfig.skipPlanGeneration = true; this.ralphWizardConfig.planGenerated = false; this.ralphWizardConfig.generatedPlan = null; diff --git a/src/web/public/index.html b/src/web/public/index.html index 8566bc69..6f972826 100644 --- a/src/web/public/index.html +++ b/src/web/public/index.html @@ -1011,11 +1011,12 @@
Claude is breaking down your task into actionable steps with tests
+Initializing deep reasoning model
+ diff --git a/src/web/public/styles.css b/src/web/public/styles.css index 9ef715b6..009a6e24 100644 --- a/src/web/public/styles.css +++ b/src/web/public/styles.css @@ -5344,7 +5344,7 @@ kbd { /* Wizard Pages */ .wizard-page { - min-height: 280px; + min-height: 180px; } .wizard-page.hidden { @@ -5482,7 +5482,15 @@ kbd { .plan-loading-hint { color: var(--text-dim); font-size: 0.85rem; - margin: 0; + margin: 0 0 1rem 0; +} + +.plan-skip-btn { + opacity: 0.6; +} + +.plan-skip-btn:hover { + opacity: 1; } .plan-error-msg { @@ -5744,11 +5752,11 @@ kbd { background: var(--bg-dark); border: 1px solid var(--border); border-radius: 4px; - padding: 0.75rem; + padding: 0.5rem 0.75rem; font-family: 'SF Mono', Monaco, 'Courier New', monospace; font-size: 0.75rem; color: var(--text-dim); - max-height: 200px; + max-height: 120px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; diff --git a/src/web/server.ts b/src/web/server.ts index 1383eb89..3f88bae0 100644 --- a/src/web/server.ts +++ b/src/web/server.ts @@ -2056,6 +2056,7 @@ export class WebServer extends EventEmitter { interface GeneratePlanRequest { taskDescription: string; maxItems?: number; + detailLevel?: 'brief' | 'standard' | 'detailed'; } interface PlanItem { @@ -2064,7 +2065,11 @@ export class WebServer extends EventEmitter { } this.app.post('/api/generate-plan', async (req): Promise