mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-29 22:02:02 +00:00
* feat: refactor Claude API Profiles to Claude Compatible Providers
- Rename ClaudeApiProfile to ClaudeCompatibleProvider with models[] array
- Each ProviderModel has mapsToClaudeModel field for Claude tier mapping
- Add providerType field for provider-specific icons (glm, minimax, openrouter)
- Add thinking level support for provider models in phase selectors
- Show all mapped Claude models per provider model (e.g., "Maps to Haiku, Sonnet, Opus")
- Add Bulk Replace feature to switch all phases to a provider at once
- Hide Bulk Replace button when no providers are enabled
- Fix project-level phaseModelOverrides not persisting after refresh
- Fix deleting last provider not persisting (remove empty array guard)
- Add getProviderByModelId() helper for all SDK routes
- Update all routes to pass provider config for provider models
- Update terminology from "profiles" to "providers" throughout UI
- Update documentation to reflect new provider system
* fix: atomic writer race condition and bulk replace reset to defaults
1. AtomicWriter Race Condition Fix (libs/utils/src/atomic-writer.ts):
- Changed temp file naming from Date.now() to Date.now() + random hex
- Uses crypto.randomBytes(4).toString('hex') for uniqueness
- Prevents ENOENT errors when multiple concurrent writes happen
within the same millisecond
2. Bulk Replace "Anthropic Direct" Reset (both dialogs):
- When selecting "Anthropic Direct", now uses DEFAULT_PHASE_MODELS
- Properly resets thinking levels and other settings to defaults
- Added thinkingLevel to the change detection comparison
- Affects both global and project-level bulk replace dialogs
* fix: update tests for new model resolver passthrough behavior
1. model-resolver tests:
- Unknown models now pass through unchanged (provider model support)
- Removed expectations for warnings on unknown models
- Updated case sensitivity and edge case tests accordingly
- Added tests for provider-like model names (GLM-4.7, MiniMax-M2.1)
2. atomic-writer tests:
- Updated regex to match new temp file format with random suffix
- Format changed from .tmp.{timestamp} to .tmp.{timestamp}.{hex}
* refactor: simplify getPhaseModelWithOverrides calls per code review
Address code review feedback on PR #629:
- Make settingsService parameter optional in getPhaseModelWithOverrides
- Function now handles undefined settingsService gracefully by returning defaults
- Remove redundant ternary checks in 4 call sites:
- apps/server/src/routes/context/routes/describe-file.ts
- apps/server/src/routes/context/routes/describe-image.ts
- apps/server/src/routes/worktree/routes/generate-commit-message.ts
- apps/server/src/services/auto-mode-service.ts
- Remove unused DEFAULT_PHASE_MODELS imports where applicable
* test: fix server tests for provider model passthrough behavior
- Update model-resolver.test.ts to expect unknown models to pass through
unchanged (supports ClaudeCompatibleProvider models like GLM-4.7)
- Remove warning expectations for unknown models (valid for providers)
- Add missing getCredentials and getGlobalSettings mocks to
ideation-service.test.ts for settingsService
* fix: address code review feedback for model providers
- Honor thinkingLevel in generate-commit-message.ts
- Pass claudeCompatibleProvider in ideation-service.ts for provider models
- Resolve provider configuration for model overrides in generate-suggestions.ts
- Update "Active Profile" to "Active Provider" label in project-claude-section
- Use substring instead of deprecated substr in api-profiles-section
- Preserve provider enabled state when editing in api-profiles-section
* fix: address CodeRabbit review issues for Claude Compatible Providers
- Fix TypeScript TS2339 error in generate-suggestions.ts where
settingsService was narrowed to 'never' type in else branch
- Use DEFAULT_PHASE_MODELS per-phase defaults instead of hardcoded
'sonnet' in settings-helpers.ts
- Remove duplicate eventHooks key in use-settings-migration.ts
- Add claudeCompatibleProviders to localStorage migration parsing
and merging functions
- Handle canonical claude-* model IDs (claude-haiku, claude-sonnet,
claude-opus) in project-models-section display names
This resolves the CI build failures and addresses code review feedback.
* fix: skip broken list-view-priority E2E test and add Priority column label
- Skip list-view-priority.spec.ts with TODO explaining the infrastructure
issue: setupRealProject only sets localStorage but server settings
take precedence with localStorageMigrated: true
- Add 'Priority' label to list-header.tsx for the priority column
(was empty string, now shows proper header text)
- Increase column width to accommodate the label
The E2E test issue is that tests create features in a temp directory,
but the server loads from the E2E Test Project fixture path set in
setup-e2e-fixtures.mjs. Needs infrastructure fix to properly switch
projects or create features through UI instead of on disk.
205 lines
6.0 KiB
TypeScript
205 lines
6.0 KiB
TypeScript
import { useState } from 'react';
|
|
import { Workflow, RotateCcw, Replace } from 'lucide-react';
|
|
import { cn } from '@/lib/utils';
|
|
import { useAppStore } from '@/store/app-store';
|
|
import { Button } from '@/components/ui/button';
|
|
import { PhaseModelSelector } from './phase-model-selector';
|
|
import { BulkReplaceDialog } from './bulk-replace-dialog';
|
|
import type { PhaseModelKey } from '@automaker/types';
|
|
import { DEFAULT_PHASE_MODELS } from '@automaker/types';
|
|
|
|
interface PhaseConfig {
|
|
key: PhaseModelKey;
|
|
label: string;
|
|
description: string;
|
|
}
|
|
|
|
const QUICK_TASKS: PhaseConfig[] = [
|
|
{
|
|
key: 'enhancementModel',
|
|
label: 'Feature Enhancement',
|
|
description: 'Improves feature names and descriptions',
|
|
},
|
|
{
|
|
key: 'fileDescriptionModel',
|
|
label: 'File Descriptions',
|
|
description: 'Generates descriptions for context files',
|
|
},
|
|
{
|
|
key: 'imageDescriptionModel',
|
|
label: 'Image Descriptions',
|
|
description: 'Analyzes and describes context images',
|
|
},
|
|
{
|
|
key: 'commitMessageModel',
|
|
label: 'Commit Messages',
|
|
description: 'Generates git commit messages from diffs',
|
|
},
|
|
];
|
|
|
|
const VALIDATION_TASKS: PhaseConfig[] = [
|
|
{
|
|
key: 'validationModel',
|
|
label: 'GitHub Issue Validation',
|
|
description: 'Validates and improves GitHub issues',
|
|
},
|
|
];
|
|
|
|
const GENERATION_TASKS: PhaseConfig[] = [
|
|
{
|
|
key: 'specGenerationModel',
|
|
label: 'App Specification',
|
|
description: 'Generates full application specifications',
|
|
},
|
|
{
|
|
key: 'featureGenerationModel',
|
|
label: 'Feature Generation',
|
|
description: 'Creates features from specifications',
|
|
},
|
|
{
|
|
key: 'backlogPlanningModel',
|
|
label: 'Backlog Planning',
|
|
description: 'Reorganizes and prioritizes backlog',
|
|
},
|
|
{
|
|
key: 'projectAnalysisModel',
|
|
label: 'Project Analysis',
|
|
description: 'Analyzes project structure for suggestions',
|
|
},
|
|
{
|
|
key: 'suggestionsModel',
|
|
label: 'AI Suggestions',
|
|
description: 'Model for feature, refactoring, security, and performance suggestions',
|
|
},
|
|
];
|
|
|
|
const MEMORY_TASKS: PhaseConfig[] = [
|
|
{
|
|
key: 'memoryExtractionModel',
|
|
label: 'Memory Extraction',
|
|
description: 'Extracts learnings from completed agent sessions',
|
|
},
|
|
];
|
|
|
|
function PhaseGroup({
|
|
title,
|
|
subtitle,
|
|
phases,
|
|
}: {
|
|
title: string;
|
|
subtitle: string;
|
|
phases: PhaseConfig[];
|
|
}) {
|
|
const { phaseModels, setPhaseModel } = useAppStore();
|
|
|
|
return (
|
|
<div className="space-y-4">
|
|
<div>
|
|
<h3 className="text-sm font-medium text-foreground">{title}</h3>
|
|
<p className="text-xs text-muted-foreground">{subtitle}</p>
|
|
</div>
|
|
<div className="space-y-3">
|
|
{phases.map((phase) => (
|
|
<PhaseModelSelector
|
|
key={phase.key}
|
|
label={phase.label}
|
|
description={phase.description}
|
|
value={phaseModels[phase.key] ?? DEFAULT_PHASE_MODELS[phase.key]}
|
|
onChange={(model) => setPhaseModel(phase.key, model)}
|
|
/>
|
|
))}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export function ModelDefaultsSection() {
|
|
const { resetPhaseModels, claudeCompatibleProviders } = useAppStore();
|
|
const [showBulkReplace, setShowBulkReplace] = useState(false);
|
|
|
|
// Check if there are any enabled ClaudeCompatibleProviders
|
|
const hasEnabledProviders =
|
|
claudeCompatibleProviders && claudeCompatibleProviders.some((p) => p.enabled !== false);
|
|
|
|
return (
|
|
<div
|
|
className={cn(
|
|
'rounded-2xl overflow-hidden',
|
|
'border border-border/50',
|
|
'bg-gradient-to-br from-card/90 via-card/70 to-card/80 backdrop-blur-xl',
|
|
'shadow-sm shadow-black/5'
|
|
)}
|
|
>
|
|
{/* Header */}
|
|
<div className="p-6 border-b border-border/50 bg-gradient-to-r from-transparent via-accent/5 to-transparent">
|
|
<div className="flex items-center justify-between">
|
|
<div className="flex items-center gap-3">
|
|
<div className="w-9 h-9 rounded-xl bg-gradient-to-br from-brand-500/20 to-brand-600/10 flex items-center justify-center border border-brand-500/20">
|
|
<Workflow className="w-5 h-5 text-brand-500" />
|
|
</div>
|
|
<div>
|
|
<h2 className="text-lg font-semibold text-foreground tracking-tight">
|
|
Model Defaults
|
|
</h2>
|
|
<p className="text-sm text-muted-foreground/80">
|
|
Configure which AI model to use for each application task
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div className="flex items-center gap-2">
|
|
{hasEnabledProviders && (
|
|
<Button
|
|
variant="outline"
|
|
size="sm"
|
|
onClick={() => setShowBulkReplace(true)}
|
|
className="gap-2"
|
|
>
|
|
<Replace className="w-3.5 h-3.5" />
|
|
Bulk Replace
|
|
</Button>
|
|
)}
|
|
<Button variant="outline" size="sm" onClick={resetPhaseModels} className="gap-2">
|
|
<RotateCcw className="w-3.5 h-3.5" />
|
|
Reset to Defaults
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Bulk Replace Dialog */}
|
|
<BulkReplaceDialog open={showBulkReplace} onOpenChange={setShowBulkReplace} />
|
|
|
|
{/* Content */}
|
|
<div className="p-6 space-y-8">
|
|
{/* Quick Tasks */}
|
|
<PhaseGroup
|
|
title="Quick Tasks"
|
|
subtitle="Fast models recommended for speed and cost savings"
|
|
phases={QUICK_TASKS}
|
|
/>
|
|
|
|
{/* Validation Tasks */}
|
|
<PhaseGroup
|
|
title="Validation Tasks"
|
|
subtitle="Smart models recommended for accuracy"
|
|
phases={VALIDATION_TASKS}
|
|
/>
|
|
|
|
{/* Generation Tasks */}
|
|
<PhaseGroup
|
|
title="Generation Tasks"
|
|
subtitle="Powerful models recommended for quality output"
|
|
phases={GENERATION_TASKS}
|
|
/>
|
|
|
|
{/* Memory Tasks */}
|
|
<PhaseGroup
|
|
title="Memory Tasks"
|
|
subtitle="Fast models recommended for learning extraction"
|
|
phases={MEMORY_TASKS}
|
|
/>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|