diff --git a/ui/goose2/AGENTS.md b/ui/goose2/AGENTS.md index b451ab1607..666ed47ee3 100644 --- a/ui/goose2/AGENTS.md +++ b/ui/goose2/AGENTS.md @@ -19,6 +19,10 @@ src/ api/ — Backend API integration (when feature calls backend) types.ts — Feature-specific type definitions (when needed) shared/ + types/ — Canonical shared type definitions (single source of truth) + agents.ts — Agent, Persona, Provider types + chat.ts — ChatState, TokenState, Session, SSE events + messages.ts — Message, MessageContent, type guards ui/ — Reusable UI components (button, etc.) lib/ — Utilities (cn.ts for class merging) theme/ — Theme provider, appearance settings @@ -27,7 +31,6 @@ src/ api/ — API integration constants/ — Shared constants context/ — Shared contexts - types/ — Shared type definitions (single source of truth) ``` ### Feature Organization @@ -133,3 +136,5 @@ ThemeProvider manages three axes: - Don't skip `type="button"` on buttons. - Don't use color-only indicators without text alternatives. - Never use `--no-verify` when pushing — fix the underlying lint/hook issues. +- Don't create root-level `src/types/` or `src/stores/` directories — types belong in `src/shared/types/`, stores belong in `src/features//stores/`. +- Don't duplicate type definitions across files — each type has one canonical location. diff --git a/ui/goose2/src/features/settings/ui/SettingsModal.tsx b/ui/goose2/src/features/settings/ui/SettingsModal.tsx index 644bbbdb0e..548aeffd83 100644 --- a/ui/goose2/src/features/settings/ui/SettingsModal.tsx +++ b/ui/goose2/src/features/settings/ui/SettingsModal.tsx @@ -100,133 +100,144 @@ export function SettingsModal({ onClose }: SettingsModalProps) { "flex w-44 flex-col border-r bg-background-secondary/50 transition-all duration-700 ease-out", isLoaded ? "opacity-100 translate-x-0" : "opacity-0 -translate-x-2", )} - > -

Settings

- - - - - {/* Content */} -
- - -
- {activeSection === "appearance" && } - {activeSection === "general" && ( -
-
-

General

-

- General settings will appear here. -

-
-
- )} - {activeSection === "projects" && ( -
-
-

Projects

-

- Manage your projects. -

-
+

Settings

+
+ +
- {/* Archived Projects */} -
-

Archived Projects

- {!loadingArchived && archivedProjects.length === 0 && ( -

- No archived projects. + {/* Content */} +

+ + +
+
+ {activeSection === "appearance" && } + {activeSection === "general" && ( +
+
+

General

+

+ General settings will appear here.

- )} - {archivedProjects.map((project) => ( -
-
- - {project.name} -
-
- - -
-
- ))} +
-
- )} - {activeSection === "about" && ( -
-

About

-

- About information will appear here. -

-
- )} + )} + {activeSection === "projects" && ( +
+
+

Projects

+

+ Manage your projects. +

+
+ + {/* Archived Projects */} +
+

Archived Projects

+ {!loadingArchived && archivedProjects.length === 0 && ( +

+ No archived projects. +

+ )} + {archivedProjects.map((project) => ( +
+
+ + + {project.name} + +
+
+ + +
+
+ ))} +
+
+ )} + {activeSection === "about" && ( +
+

About

+

+ About information will appear here. +

+
+ )} +
diff --git a/ui/goose2/src/shared/api/chat.ts b/ui/goose2/src/shared/api/chat.ts index e693a2d2b3..79e7dd2bd4 100644 --- a/ui/goose2/src/shared/api/chat.ts +++ b/ui/goose2/src/shared/api/chat.ts @@ -1,6 +1,6 @@ import { invoke } from "@tauri-apps/api/core"; import type { Message } from "@/shared/types/messages"; -import type { Session } from "@/shared/types/agents"; +import type { Session } from "@/shared/types/chat"; export async function createSession(agentId?: string): Promise { return invoke("create_session", { agentId }); diff --git a/ui/goose2/src/shared/types/agents.ts b/ui/goose2/src/shared/types/agents.ts index 6bd5dbb685..0ab77ccaa3 100644 --- a/ui/goose2/src/shared/types/agents.ts +++ b/ui/goose2/src/shared/types/agents.ts @@ -79,47 +79,4 @@ export interface CreateAgentRequest { acpEndpoint?: string; } -// Session types -export interface Session { - id: string; - title: string; - agentId?: string; - createdAt: string; - updatedAt: string; - messageCount: number; - lastMessagePreview?: string; -} - -// Token tracking -export interface TokenState { - inputTokens: number; - outputTokens: number; - totalTokens: number; - accumulatedInput: number; - accumulatedOutput: number; - accumulatedTotal: number; -} - -// Chat state -export type ChatState = - | "idle" - | "thinking" - | "streaming" - | "waiting" - | "compacting" - | "error"; - -// SSE event types (from goosed server) -export type MessageEventType = - | "message" - | "error" - | "finish" - | "modelChange" - | "notification" - | "updateConversation" - | "ping"; - -export interface MessageEvent { - type: MessageEventType; - data: unknown; -} +// Session, TokenState, ChatState, and MessageEventType are defined in ./chat.ts diff --git a/ui/goose2/src/shared/types/index.ts b/ui/goose2/src/shared/types/index.ts index e2876b3edc..dc8e5e11de 100644 --- a/ui/goose2/src/shared/types/index.ts +++ b/ui/goose2/src/shared/types/index.ts @@ -1,2 +1,3 @@ export * from "./messages"; export * from "./agents"; +export * from "./chat";