mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 08:33:36 +00:00
Merge remote-tracking branch 'origin/main' into feat/extend-models-support
This commit is contained in:
@@ -2,8 +2,31 @@ import { create } from "zustand";
|
||||
import { persist } from "zustand/middleware";
|
||||
import type { Project } from "@/lib/electron";
|
||||
|
||||
export type ViewMode = "welcome" | "spec" | "board" | "agent" | "settings" | "tools" | "interview" | "context";
|
||||
export type ThemeMode = "light" | "dark" | "system";
|
||||
export type ViewMode =
|
||||
| "welcome"
|
||||
| "spec"
|
||||
| "board"
|
||||
| "agent"
|
||||
| "settings"
|
||||
| "tools"
|
||||
| "interview"
|
||||
| "context";
|
||||
|
||||
export type ThemeMode =
|
||||
| "light"
|
||||
| "dark"
|
||||
| "system"
|
||||
| "retro"
|
||||
| "dracula"
|
||||
| "nord"
|
||||
| "monokai"
|
||||
| "tokyonight"
|
||||
| "solarized"
|
||||
| "gruvbox"
|
||||
| "catppuccin"
|
||||
| "onedark"
|
||||
| "synthwave";
|
||||
|
||||
export type KanbanCardDetailLevel = "minimal" | "standard" | "detailed";
|
||||
|
||||
export interface ApiKeys {
|
||||
@@ -116,7 +139,15 @@ export interface AutoModeActivity {
|
||||
id: string;
|
||||
featureId: string;
|
||||
timestamp: Date;
|
||||
type: "start" | "progress" | "tool" | "complete" | "error" | "planning" | "action" | "verification";
|
||||
type:
|
||||
| "start"
|
||||
| "progress"
|
||||
| "tool"
|
||||
| "complete"
|
||||
| "error"
|
||||
| "planning"
|
||||
| "action"
|
||||
| "verification";
|
||||
message: string;
|
||||
tool?: string;
|
||||
passes?: boolean;
|
||||
@@ -170,7 +201,9 @@ export interface AppActions {
|
||||
addRunningTask: (taskId: string) => void;
|
||||
removeRunningTask: (taskId: string) => void;
|
||||
clearRunningTasks: () => void;
|
||||
addAutoModeActivity: (activity: Omit<AutoModeActivity, "id" | "timestamp">) => void;
|
||||
addAutoModeActivity: (
|
||||
activity: Omit<AutoModeActivity, "id" | "timestamp">
|
||||
) => void;
|
||||
clearAutoModeActivity: () => void;
|
||||
setMaxConcurrency: (max: number) => void;
|
||||
|
||||
@@ -217,11 +250,17 @@ export const useAppStore = create<AppState & AppActions>()(
|
||||
const existing = projects.findIndex((p) => p.path === project.path);
|
||||
if (existing >= 0) {
|
||||
const updated = [...projects];
|
||||
updated[existing] = { ...project, lastOpened: new Date().toISOString() };
|
||||
updated[existing] = {
|
||||
...project,
|
||||
lastOpened: new Date().toISOString(),
|
||||
};
|
||||
set({ projects: updated });
|
||||
} else {
|
||||
set({
|
||||
projects: [...projects, { ...project, lastOpened: new Date().toISOString() }],
|
||||
projects: [
|
||||
...projects,
|
||||
{ ...project, lastOpened: new Date().toISOString() },
|
||||
],
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -259,7 +298,9 @@ export const useAppStore = create<AppState & AppActions>()(
|
||||
},
|
||||
|
||||
addFeature: (feature) => {
|
||||
const id = `feature-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
||||
const id = `feature-${Date.now()}-${Math.random()
|
||||
.toString(36)
|
||||
.substr(2, 9)}`;
|
||||
set({ features: [...get().features, { ...feature, id }] });
|
||||
},
|
||||
|
||||
@@ -294,14 +335,19 @@ export const useAppStore = create<AppState & AppActions>()(
|
||||
const now = new Date();
|
||||
const session: ChatSession = {
|
||||
id: `chat-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
|
||||
title: title || `Chat ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}`,
|
||||
title:
|
||||
title ||
|
||||
`Chat ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}`,
|
||||
projectId: currentProject.id,
|
||||
messages: [{
|
||||
id: "welcome",
|
||||
role: "assistant",
|
||||
content: "Hello! I'm the Automaker Agent. I can help you build software autonomously. What would you like to create today?",
|
||||
timestamp: now,
|
||||
}],
|
||||
messages: [
|
||||
{
|
||||
id: "welcome",
|
||||
role: "assistant",
|
||||
content:
|
||||
"Hello! I'm the Automaker Agent. I can help you build software autonomously. What would you like to create today?",
|
||||
timestamp: now,
|
||||
},
|
||||
],
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
archived: false,
|
||||
@@ -328,14 +374,18 @@ export const useAppStore = create<AppState & AppActions>()(
|
||||
const currentSession = get().currentChatSession;
|
||||
if (currentSession && currentSession.id === sessionId) {
|
||||
set({
|
||||
currentChatSession: { ...currentSession, ...updates, updatedAt: new Date() }
|
||||
currentChatSession: {
|
||||
...currentSession,
|
||||
...updates,
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
addMessageToSession: (sessionId, message) => {
|
||||
const sessions = get().chatSessions;
|
||||
const sessionIndex = sessions.findIndex(s => s.id === sessionId);
|
||||
const sessionIndex = sessions.findIndex((s) => s.id === sessionId);
|
||||
|
||||
if (sessionIndex >= 0) {
|
||||
const updatedSessions = [...sessions];
|
||||
@@ -351,7 +401,7 @@ export const useAppStore = create<AppState & AppActions>()(
|
||||
const currentSession = get().currentChatSession;
|
||||
if (currentSession && currentSession.id === sessionId) {
|
||||
set({
|
||||
currentChatSession: updatedSessions[sessionIndex]
|
||||
currentChatSession: updatedSessions[sessionIndex],
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -373,7 +423,8 @@ export const useAppStore = create<AppState & AppActions>()(
|
||||
const currentSession = get().currentChatSession;
|
||||
set({
|
||||
chatSessions: get().chatSessions.filter((s) => s.id !== sessionId),
|
||||
currentChatSession: currentSession?.id === sessionId ? null : currentSession,
|
||||
currentChatSession:
|
||||
currentSession?.id === sessionId ? null : currentSession,
|
||||
});
|
||||
},
|
||||
|
||||
@@ -392,13 +443,19 @@ export const useAppStore = create<AppState & AppActions>()(
|
||||
},
|
||||
|
||||
removeRunningTask: (taskId) => {
|
||||
set({ runningAutoTasks: get().runningAutoTasks.filter(id => id !== taskId) });
|
||||
set({
|
||||
runningAutoTasks: get().runningAutoTasks.filter(
|
||||
(id) => id !== taskId
|
||||
),
|
||||
});
|
||||
},
|
||||
|
||||
clearRunningTasks: () => set({ runningAutoTasks: [] }),
|
||||
|
||||
addAutoModeActivity: (activity) => {
|
||||
const id = `activity-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
||||
const id = `activity-${Date.now()}-${Math.random()
|
||||
.toString(36)
|
||||
.substr(2, 9)}`;
|
||||
const newActivity: AutoModeActivity = {
|
||||
...activity,
|
||||
id,
|
||||
@@ -417,7 +474,8 @@ export const useAppStore = create<AppState & AppActions>()(
|
||||
setMaxConcurrency: (max) => set({ maxConcurrency: max }),
|
||||
|
||||
// Kanban Card Settings actions
|
||||
setKanbanCardDetailLevel: (level) => set({ kanbanCardDetailLevel: level }),
|
||||
setKanbanCardDetailLevel: (level) =>
|
||||
set({ kanbanCardDetailLevel: level }),
|
||||
|
||||
// Reset
|
||||
reset: () => set(initialState),
|
||||
|
||||
Reference in New Issue
Block a user