fix: additional fixes for http error handling and path resolution

- http-client.ts: Limit error response data collection to 10KB and add error handlers
- RoadmapGenerationProgress.tsx, GenerationProgressScreen.tsx: Allow onStop to return Promise<void>
- insights_runner.py: Fix path resolution and load .env from auto-claude directory

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
AndyMik90
2025-12-18 20:30:17 +01:00
parent f1d578fd18
commit 54501cbd73
4 changed files with 26 additions and 7 deletions
+16 -4
View File
@@ -27,13 +27,19 @@ export function fetchJson<T>(url: string): Promise<T> {
}
if (response.statusCode !== 200) {
// Collect response body for error details
// Collect response body for error details (limit to 10KB)
const maxErrorSize = 10 * 1024;
let errorData = '';
response.on('data', chunk => errorData += chunk);
response.on('data', chunk => {
if (errorData.length < maxErrorSize) {
errorData += chunk.toString().slice(0, maxErrorSize - errorData.length);
}
});
response.on('end', () => {
const errorMsg = `HTTP ${response.statusCode}: ${errorData || response.statusMessage || 'No error details'}`;
reject(new Error(errorMsg));
});
response.on('error', reject);
return;
}
@@ -86,13 +92,19 @@ export function downloadFile(
if (response.statusCode !== 200) {
file.close();
// Collect response body for error details
// Collect response body for error details (limit to 10KB)
const maxErrorSize = 10 * 1024;
let errorData = '';
response.on('data', chunk => errorData += chunk);
response.on('data', chunk => {
if (errorData.length < maxErrorSize) {
errorData += chunk.toString().slice(0, maxErrorSize - errorData.length);
}
});
response.on('end', () => {
const errorMsg = `HTTP ${response.statusCode}: ${errorData || response.statusMessage || 'No error details'}`;
reject(new Error(errorMsg));
});
response.on('error', reject);
return;
}
@@ -38,7 +38,7 @@ function useReducedMotion(): boolean {
interface RoadmapGenerationProgressProps {
generationStatus: RoadmapGenerationStatus;
className?: string;
onStop?: () => void;
onStop?: () => void | Promise<void>;
}
// Type for generation phases (excluding idle)
@@ -33,7 +33,7 @@ interface GenerationProgressScreenProps {
onConvert: (idea: Idea) => void;
onGoToTask?: (taskId: string) => void;
onDismiss: (idea: Idea) => void;
onStop: () => void;
onStop: () => void | Promise<void>;
}
export function GenerationProgressScreen({
+8 -1
View File
@@ -14,7 +14,14 @@ import sys
from pathlib import Path
# Add auto-claude to path
sys.path.insert(0, str(Path(__file__).parent))
sys.path.insert(0, str(Path(__file__).parent.parent))
# Load .env file from auto-claude/ directory
from dotenv import load_dotenv
env_file = Path(__file__).parent.parent / ".env"
if env_file.exists():
load_dotenv(env_file)
try:
from claude_agent_sdk import ClaudeAgentOptions, ClaudeSDKClient