mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 08:13:37 +00:00
merge: sync with upstream v0.9.0rc branch
This commit is contained in:
@@ -728,6 +728,83 @@ export interface ElectronAPI {
|
||||
codex?: {
|
||||
getUsage: () => Promise<CodexUsageResponse>;
|
||||
};
|
||||
settings?: {
|
||||
getStatus: () => Promise<{
|
||||
success: boolean;
|
||||
hasGlobalSettings: boolean;
|
||||
hasCredentials: boolean;
|
||||
dataDir: string;
|
||||
needsMigration: boolean;
|
||||
}>;
|
||||
getGlobal: () => Promise<{
|
||||
success: boolean;
|
||||
settings?: Record<string, unknown>;
|
||||
error?: string;
|
||||
}>;
|
||||
updateGlobal: (updates: Record<string, unknown>) => Promise<{
|
||||
success: boolean;
|
||||
settings?: Record<string, unknown>;
|
||||
error?: string;
|
||||
}>;
|
||||
getCredentials: () => Promise<{
|
||||
success: boolean;
|
||||
credentials?: {
|
||||
anthropic: { configured: boolean; masked: string };
|
||||
google: { configured: boolean; masked: string };
|
||||
openai: { configured: boolean; masked: string };
|
||||
};
|
||||
error?: string;
|
||||
}>;
|
||||
updateCredentials: (updates: {
|
||||
apiKeys?: { anthropic?: string; google?: string; openai?: string };
|
||||
}) => Promise<{
|
||||
success: boolean;
|
||||
credentials?: {
|
||||
anthropic: { configured: boolean; masked: string };
|
||||
google: { configured: boolean; masked: string };
|
||||
openai: { configured: boolean; masked: string };
|
||||
};
|
||||
error?: string;
|
||||
}>;
|
||||
getProject: (projectPath: string) => Promise<{
|
||||
success: boolean;
|
||||
settings?: Record<string, unknown>;
|
||||
error?: string;
|
||||
}>;
|
||||
updateProject: (
|
||||
projectPath: string,
|
||||
updates: Record<string, unknown>
|
||||
) => Promise<{
|
||||
success: boolean;
|
||||
settings?: Record<string, unknown>;
|
||||
error?: string;
|
||||
}>;
|
||||
migrate: (data: Record<string, string>) => Promise<{
|
||||
success: boolean;
|
||||
migratedGlobalSettings: boolean;
|
||||
migratedCredentials: boolean;
|
||||
migratedProjectCount: number;
|
||||
errors: string[];
|
||||
}>;
|
||||
discoverAgents: (
|
||||
projectPath?: string,
|
||||
sources?: Array<'user' | 'project'>
|
||||
) => Promise<{
|
||||
success: boolean;
|
||||
agents?: Array<{
|
||||
name: string;
|
||||
definition: {
|
||||
description: string;
|
||||
prompt: string;
|
||||
tools?: string[];
|
||||
model?: 'sonnet' | 'opus' | 'haiku' | 'inherit';
|
||||
};
|
||||
source: 'user' | 'project';
|
||||
filePath: string;
|
||||
}>;
|
||||
error?: string;
|
||||
}>;
|
||||
};
|
||||
}
|
||||
|
||||
// Note: Window interface is declared in @/types/electron.d.ts
|
||||
|
||||
@@ -23,8 +23,6 @@ import type {
|
||||
SpecRegenerationEvent,
|
||||
SuggestionType,
|
||||
GitHubAPI,
|
||||
GitHubIssue,
|
||||
GitHubPR,
|
||||
IssueValidationInput,
|
||||
IssueValidationEvent,
|
||||
IdeationAPI,
|
||||
@@ -1891,6 +1889,26 @@ export class HttpApiClient implements ElectronAPI {
|
||||
migratedProjectCount: number;
|
||||
errors: string[];
|
||||
}> => this.post('/api/settings/migrate', { data }),
|
||||
|
||||
// Filesystem agents discovery (read-only)
|
||||
discoverAgents: (
|
||||
projectPath?: string,
|
||||
sources?: Array<'user' | 'project'>
|
||||
): Promise<{
|
||||
success: boolean;
|
||||
agents?: Array<{
|
||||
name: string;
|
||||
definition: {
|
||||
description: string;
|
||||
prompt: string;
|
||||
tools?: string[];
|
||||
model?: 'sonnet' | 'opus' | 'haiku' | 'inherit';
|
||||
};
|
||||
source: 'user' | 'project';
|
||||
filePath: string;
|
||||
}>;
|
||||
error?: string;
|
||||
}> => this.post('/api/settings/agents/discover', { projectPath, sources }),
|
||||
};
|
||||
|
||||
// Sessions API
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import { createLogger } from '@automaker/utils/logger';
|
||||
import { getHttpApiClient } from './http-api-client';
|
||||
import { getElectronAPI } from './electron';
|
||||
import { useAppStore } from '@/store/app-store';
|
||||
|
||||
const logger = createLogger('WorkspaceConfig');
|
||||
@@ -33,9 +32,17 @@ function joinPath(...parts: string[]): string {
|
||||
*/
|
||||
async function getDefaultDocumentsPath(): Promise<string | null> {
|
||||
try {
|
||||
const api = getElectronAPI();
|
||||
const documentsPath = await api.getPath('documents');
|
||||
return joinPath(documentsPath, 'Automaker');
|
||||
// In Electron mode, use the native getPath API directly from the preload script
|
||||
// This returns the actual system Documents folder (e.g., C:\Users\<user>\Documents on Windows)
|
||||
// Note: The HTTP client's getPath returns incorrect Unix-style paths for 'documents'
|
||||
if (typeof window !== 'undefined' && (window as any).electronAPI?.getPath) {
|
||||
const documentsPath = await (window as any).electronAPI.getPath('documents');
|
||||
return joinPath(documentsPath, 'Automaker');
|
||||
}
|
||||
|
||||
// In web mode (no Electron), we can't access the user's Documents folder
|
||||
// Return null to let the caller use other fallback mechanisms (like server's DATA_DIR)
|
||||
return null;
|
||||
} catch (error) {
|
||||
logger.error('Failed to get documents path:', error);
|
||||
return null;
|
||||
@@ -76,6 +83,7 @@ export async function getDefaultWorkspaceDirectory(): Promise<string | null> {
|
||||
|
||||
// Try to get Documents/Automaker
|
||||
const documentsPath = await getDefaultDocumentsPath();
|
||||
logger.info('Default documentsPath resolved to:', documentsPath);
|
||||
if (documentsPath) {
|
||||
return documentsPath;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user