Add BRAIN_DISABLED flag and fix Ollama tool call formatting
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)
This commit is contained in:
91
src/types/agent-definition.ts
Normal file
91
src/types/agent-definition.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* Agent markdown definition types
|
||||
* Agents are defined in markdown files with YAML frontmatter
|
||||
* Location: .codetyper/agents/*.md
|
||||
*/
|
||||
|
||||
export type AgentTier = "fast" | "balanced" | "thorough";
|
||||
|
||||
export type AgentColor =
|
||||
| "red"
|
||||
| "green"
|
||||
| "blue"
|
||||
| "yellow"
|
||||
| "cyan"
|
||||
| "magenta"
|
||||
| "white"
|
||||
| "gray";
|
||||
|
||||
export interface AgentDefinition {
|
||||
readonly name: string;
|
||||
readonly description: string;
|
||||
readonly tools: ReadonlyArray<string>;
|
||||
readonly tier: AgentTier;
|
||||
readonly color: AgentColor;
|
||||
readonly maxTurns?: number;
|
||||
readonly systemPrompt?: string;
|
||||
readonly triggerPhrases?: ReadonlyArray<string>;
|
||||
readonly capabilities?: ReadonlyArray<string>;
|
||||
readonly permissions?: AgentPermissions;
|
||||
}
|
||||
|
||||
export interface AgentPermissions {
|
||||
readonly allowedPaths?: ReadonlyArray<string>;
|
||||
readonly deniedPaths?: ReadonlyArray<string>;
|
||||
readonly allowedTools?: ReadonlyArray<string>;
|
||||
readonly deniedTools?: ReadonlyArray<string>;
|
||||
readonly requireApproval?: ReadonlyArray<string>;
|
||||
}
|
||||
|
||||
export interface AgentDefinitionFile {
|
||||
readonly filePath: string;
|
||||
readonly frontmatter: AgentFrontmatter;
|
||||
readonly content: string;
|
||||
readonly parsed: AgentDefinition;
|
||||
}
|
||||
|
||||
export interface AgentFrontmatter {
|
||||
readonly name: string;
|
||||
readonly description: string;
|
||||
readonly tools: ReadonlyArray<string>;
|
||||
readonly tier?: AgentTier;
|
||||
readonly color?: AgentColor;
|
||||
readonly maxTurns?: number;
|
||||
readonly triggerPhrases?: ReadonlyArray<string>;
|
||||
readonly capabilities?: ReadonlyArray<string>;
|
||||
readonly allowedPaths?: ReadonlyArray<string>;
|
||||
readonly deniedPaths?: ReadonlyArray<string>;
|
||||
}
|
||||
|
||||
export interface AgentRegistry {
|
||||
readonly agents: ReadonlyMap<string, AgentDefinition>;
|
||||
readonly byTrigger: ReadonlyMap<string, string>;
|
||||
readonly byCapability: ReadonlyMap<string, ReadonlyArray<string>>;
|
||||
}
|
||||
|
||||
export interface AgentLoadResult {
|
||||
readonly success: boolean;
|
||||
readonly agent?: AgentDefinition;
|
||||
readonly error?: string;
|
||||
readonly filePath: string;
|
||||
}
|
||||
|
||||
export const DEFAULT_AGENT_DEFINITION: Partial<AgentDefinition> = {
|
||||
tier: "balanced",
|
||||
color: "cyan",
|
||||
maxTurns: 10,
|
||||
tools: ["read", "glob", "grep"],
|
||||
capabilities: [],
|
||||
triggerPhrases: [],
|
||||
};
|
||||
|
||||
export const AGENT_TIER_MODELS: Record<AgentTier, string> = {
|
||||
fast: "gpt-4o-mini",
|
||||
balanced: "gpt-4o",
|
||||
thorough: "o1",
|
||||
};
|
||||
|
||||
export const AGENT_DEFINITION_SCHEMA = {
|
||||
required: ["name", "description", "tools"],
|
||||
optional: ["tier", "color", "maxTurns", "triggerPhrases", "capabilities", "allowedPaths", "deniedPaths"],
|
||||
};
|
||||
Reference in New Issue
Block a user