Features: - Add BRAIN_DISABLED feature flag to hide all Brain functionality - When enabled, hides Brain banner, status indicator, menu, and commands - Flag location: src/constants/brain.ts Fixes: - Fix Ollama 400 error by properly formatting tool_calls in messages - Update OllamaMessage type to include tool_calls field - Fix Brain menu keyboard not working (add missing modes to isMenuOpen) UI Changes: - Remove "^Tab toggle mode" hint from status bar - Remove "ctrl+t to hide todos" hint from status bar Files modified: - src/constants/brain.ts (add BRAIN_DISABLED flag) - src/types/ollama.ts (add tool_calls to OllamaMessage) - src/providers/ollama/chat.ts (format tool_calls in messages) - src/tui-solid/components/header.tsx (hide Brain UI when disabled) - src/tui-solid/components/status-bar.tsx (remove hints) - src/tui-solid/components/command-menu.tsx (filter brain command) - src/tui-solid/components/input-area.tsx (fix isMenuOpen modes) - src/tui-solid/routes/session.tsx (skip brain menu when disabled) - src/services/brain.ts (early return when disabled) - src/services/chat-tui/initialize.ts (skip brain init when disabled)
70 lines
1.9 KiB
TypeScript
70 lines
1.9 KiB
TypeScript
/**
|
|
* Multi-project Brain constants
|
|
*/
|
|
|
|
export const BRAIN_PROJECT = {
|
|
MAX_PROJECTS: 100,
|
|
NAME_MIN_LENGTH: 2,
|
|
NAME_MAX_LENGTH: 100,
|
|
DESCRIPTION_MAX_LENGTH: 500,
|
|
DEFAULT_RECALL_LIMIT: 5,
|
|
DEFAULT_SYNC_INTERVAL: 30, // minutes
|
|
} as const;
|
|
|
|
export const BRAIN_PROJECT_STORAGE = {
|
|
CONFIG_FILE: "brain-projects.json",
|
|
EXPORT_EXTENSION: ".brain-export.json",
|
|
BACKUP_EXTENSION: ".brain-backup.json",
|
|
} as const;
|
|
|
|
export const BRAIN_PROJECT_PATHS = {
|
|
LOCAL: ".codetyper/brain",
|
|
GLOBAL: "~/.local/share/codetyper/brain",
|
|
EXPORTS: "~/.local/share/codetyper/brain/exports",
|
|
BACKUPS: "~/.local/share/codetyper/brain/backups",
|
|
} as const;
|
|
|
|
export const BRAIN_PROJECT_COMMANDS = {
|
|
LIST: "/brain projects",
|
|
CREATE: "/brain project create",
|
|
SWITCH: "/brain project switch",
|
|
DELETE: "/brain project delete",
|
|
EXPORT: "/brain project export",
|
|
IMPORT: "/brain project import",
|
|
SYNC: "/brain project sync",
|
|
} as const;
|
|
|
|
export const BRAIN_PROJECT_API = {
|
|
LIST: "/api/projects",
|
|
CREATE: "/api/projects",
|
|
GET: "/api/projects/:id",
|
|
UPDATE: "/api/projects/:id",
|
|
DELETE: "/api/projects/:id",
|
|
SWITCH: "/api/projects/:id/switch",
|
|
EXPORT: "/api/projects/:id/export",
|
|
IMPORT: "/api/projects/import",
|
|
SYNC: "/api/projects/:id/sync",
|
|
} as const;
|
|
|
|
export const BRAIN_PROJECT_MESSAGES = {
|
|
CREATED: "Brain project created successfully",
|
|
SWITCHED: "Switched to project",
|
|
DELETED: "Brain project deleted",
|
|
EXPORTED: "Brain project exported",
|
|
IMPORTED: "Brain project imported",
|
|
SYNCED: "Brain project synced",
|
|
NOT_FOUND: "Brain project not found",
|
|
ALREADY_EXISTS: "Project with this name already exists",
|
|
INVALID_NAME: "Invalid project name",
|
|
SWITCH_FAILED: "Failed to switch project",
|
|
EXPORT_FAILED: "Failed to export project",
|
|
IMPORT_FAILED: "Failed to import project",
|
|
} as const;
|
|
|
|
export const BRAIN_PROJECT_DEFAULTS = {
|
|
AUTO_LEARN: true,
|
|
AUTO_RECALL: true,
|
|
CONTEXT_INJECTION: true,
|
|
SYNC_ENABLED: false,
|
|
} as const;
|