fraude-code 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/README.md +68 -0
  2. package/dist/index.js +179297 -0
  3. package/package.json +88 -0
  4. package/src/agent/agent.ts +475 -0
  5. package/src/agent/contextManager.ts +141 -0
  6. package/src/agent/index.ts +14 -0
  7. package/src/agent/pendingChanges.ts +270 -0
  8. package/src/agent/prompts/AskPrompt.txt +10 -0
  9. package/src/agent/prompts/FastPrompt.txt +40 -0
  10. package/src/agent/prompts/PlannerPrompt.txt +51 -0
  11. package/src/agent/prompts/ReviewerPrompt.txt +57 -0
  12. package/src/agent/prompts/WorkerPrompt.txt +33 -0
  13. package/src/agent/subagents/askAgent.ts +37 -0
  14. package/src/agent/subagents/extractionAgent.ts +123 -0
  15. package/src/agent/subagents/fastAgent.ts +45 -0
  16. package/src/agent/subagents/managerAgent.ts +36 -0
  17. package/src/agent/subagents/relationAgent.ts +76 -0
  18. package/src/agent/subagents/researchSubAgent.ts +79 -0
  19. package/src/agent/subagents/reviewerSubAgent.ts +42 -0
  20. package/src/agent/subagents/workerSubAgent.ts +42 -0
  21. package/src/agent/tools/bashTool.ts +94 -0
  22. package/src/agent/tools/descriptions/bash.txt +47 -0
  23. package/src/agent/tools/descriptions/edit.txt +7 -0
  24. package/src/agent/tools/descriptions/glob.txt +4 -0
  25. package/src/agent/tools/descriptions/grep.txt +8 -0
  26. package/src/agent/tools/descriptions/lsp.txt +20 -0
  27. package/src/agent/tools/descriptions/plan.txt +3 -0
  28. package/src/agent/tools/descriptions/read.txt +9 -0
  29. package/src/agent/tools/descriptions/todo.txt +12 -0
  30. package/src/agent/tools/descriptions/write.txt +8 -0
  31. package/src/agent/tools/editTool.ts +44 -0
  32. package/src/agent/tools/globTool.ts +59 -0
  33. package/src/agent/tools/grepTool.ts +343 -0
  34. package/src/agent/tools/lspTool.ts +429 -0
  35. package/src/agent/tools/planTool.ts +118 -0
  36. package/src/agent/tools/readTool.ts +78 -0
  37. package/src/agent/tools/rememberTool.ts +91 -0
  38. package/src/agent/tools/testRunnerTool.ts +77 -0
  39. package/src/agent/tools/testTool.ts +44 -0
  40. package/src/agent/tools/todoTool.ts +224 -0
  41. package/src/agent/tools/writeTool.ts +33 -0
  42. package/src/commands/COMMANDS.ts +38 -0
  43. package/src/commands/cerebras/auth.ts +27 -0
  44. package/src/commands/cerebras/index.ts +31 -0
  45. package/src/commands/forget.ts +29 -0
  46. package/src/commands/google/auth.ts +24 -0
  47. package/src/commands/google/index.ts +31 -0
  48. package/src/commands/groq/add_model.ts +60 -0
  49. package/src/commands/groq/auth.ts +24 -0
  50. package/src/commands/groq/index.ts +33 -0
  51. package/src/commands/index.ts +65 -0
  52. package/src/commands/knowledge.ts +92 -0
  53. package/src/commands/log.ts +32 -0
  54. package/src/commands/mistral/auth.ts +27 -0
  55. package/src/commands/mistral/index.ts +31 -0
  56. package/src/commands/model/index.ts +145 -0
  57. package/src/commands/models/index.ts +16 -0
  58. package/src/commands/ollama/index.ts +29 -0
  59. package/src/commands/openrouter/add_model.ts +64 -0
  60. package/src/commands/openrouter/auth.ts +24 -0
  61. package/src/commands/openrouter/index.ts +33 -0
  62. package/src/commands/remember.ts +48 -0
  63. package/src/commands/serve.ts +31 -0
  64. package/src/commands/session/index.ts +21 -0
  65. package/src/commands/usage.ts +15 -0
  66. package/src/commands/visualize.ts +773 -0
  67. package/src/components/App.tsx +55 -0
  68. package/src/components/IntroComponent.tsx +70 -0
  69. package/src/components/LoaderComponent.tsx +68 -0
  70. package/src/components/OutputRenderer.tsx +88 -0
  71. package/src/components/SettingsRenderer.tsx +23 -0
  72. package/src/components/input/CommandSuggestions.tsx +41 -0
  73. package/src/components/input/FileSuggestions.tsx +61 -0
  74. package/src/components/input/InputBox.tsx +371 -0
  75. package/src/components/output/CheckpointView.tsx +13 -0
  76. package/src/components/output/CommandView.tsx +13 -0
  77. package/src/components/output/CommentView.tsx +12 -0
  78. package/src/components/output/ConfirmationView.tsx +179 -0
  79. package/src/components/output/ContextUsage.tsx +62 -0
  80. package/src/components/output/DiffView.tsx +202 -0
  81. package/src/components/output/ErrorView.tsx +14 -0
  82. package/src/components/output/InteractiveServerView.tsx +69 -0
  83. package/src/components/output/KnowledgeView.tsx +220 -0
  84. package/src/components/output/MarkdownView.tsx +15 -0
  85. package/src/components/output/ModelSelectView.tsx +71 -0
  86. package/src/components/output/ReasoningView.tsx +21 -0
  87. package/src/components/output/ToolCallView.tsx +45 -0
  88. package/src/components/settings/ModelList.tsx +250 -0
  89. package/src/components/settings/TokenUsage.tsx +274 -0
  90. package/src/config/schema.ts +19 -0
  91. package/src/config/settings.ts +229 -0
  92. package/src/index.tsx +100 -0
  93. package/src/parsers/tree-sitter-python.wasm +0 -0
  94. package/src/providers/providers.ts +71 -0
  95. package/src/services/PluginLoader.ts +123 -0
  96. package/src/services/cerebras.ts +69 -0
  97. package/src/services/embeddingService.ts +229 -0
  98. package/src/services/google.ts +65 -0
  99. package/src/services/graphSerializer.ts +248 -0
  100. package/src/services/groq.ts +23 -0
  101. package/src/services/knowledgeOrchestrator.ts +286 -0
  102. package/src/services/mistral.ts +79 -0
  103. package/src/services/ollama.ts +109 -0
  104. package/src/services/openrouter.ts +23 -0
  105. package/src/services/symbolExtractor.ts +277 -0
  106. package/src/store/useFraudeStore.ts +123 -0
  107. package/src/store/useSettingsStore.ts +38 -0
  108. package/src/theme.ts +26 -0
  109. package/src/types/Agent.ts +147 -0
  110. package/src/types/CommandDefinition.ts +8 -0
  111. package/src/types/Model.ts +94 -0
  112. package/src/types/OutputItem.ts +24 -0
  113. package/src/types/PluginContext.ts +55 -0
  114. package/src/types/TokenUsage.ts +5 -0
  115. package/src/types/assets.d.ts +4 -0
  116. package/src/utils/agentCognition.ts +1152 -0
  117. package/src/utils/fileSuggestions.ts +111 -0
  118. package/src/utils/index.ts +17 -0
  119. package/src/utils/initFraude.ts +8 -0
  120. package/src/utils/logger.ts +24 -0
  121. package/src/utils/lspClient.ts +1415 -0
  122. package/src/utils/paths.ts +24 -0
  123. package/src/utils/queryHandler.ts +227 -0
  124. package/src/utils/router.ts +278 -0
  125. package/src/utils/streamHandler.ts +132 -0
  126. package/src/utils/treeSitterQueries.ts +125 -0
  127. package/tsconfig.json +33 -0
@@ -0,0 +1,91 @@
1
+ import { tool } from "ai";
2
+ import { z } from "zod";
3
+ import useFraudeStore from "@/store/useFraudeStore";
4
+ import AgentCognition from "@/utils/agentCognition";
5
+
6
+ const { updateOutput } = useFraudeStore.getState();
7
+
8
+ const DESCRIPTION = `Store important information for future sessions.
9
+
10
+ Use this tool to remember key facts, decisions, concepts, or file references that should persist across agent sessions. The agent will automatically validate and retrieve relevant knowledge in future sessions.
11
+
12
+ Types:
13
+ - fact: Learned information about the codebase (e.g., "API uses REST with JWT auth")
14
+ - decision: Architectural or implementation choices (e.g., "Using Zustand over Redux")
15
+ - concept: Domain knowledge (e.g., "User sessions expire after 24h")
16
+ - reference: File or function relationships (e.g., "auth.ts handles all authentication")
17
+
18
+ For references, include file paths to enable validation.`;
19
+
20
+ const rememberTool = tool({
21
+ description: DESCRIPTION,
22
+ strict: true,
23
+ inputSchema: z.object({
24
+ fact: z.string().describe("The information to remember"),
25
+ type: z
26
+ .enum(["fact", "decision", "concept", "reference"])
27
+ .describe("Type of knowledge being stored"),
28
+ file: z
29
+ .string()
30
+ .optional()
31
+ .describe("Optional file path this knowledge relates to"),
32
+ symbol: z
33
+ .string()
34
+ .optional()
35
+ .describe("Optional function/class name this knowledge relates to"),
36
+ confidence: z
37
+ .number()
38
+ .min(0)
39
+ .max(1)
40
+ .default(0.9)
41
+ .describe(
42
+ "Confidence level (0-1). Default 0.9 for explicit user requests",
43
+ ),
44
+ }),
45
+ execute: async ({
46
+ fact,
47
+ type,
48
+ file,
49
+ symbol,
50
+ confidence,
51
+ }: {
52
+ fact: string;
53
+ type: "fact" | "decision" | "concept" | "reference";
54
+ file?: string;
55
+ symbol?: string;
56
+ confidence: number;
57
+ }) => {
58
+ const cognition = AgentCognition.getInstance();
59
+ await cognition.init();
60
+
61
+ // Build data object
62
+ const data: Record<string, string> = {};
63
+ if (file) data.file = file;
64
+ if (symbol) data.symbol = symbol;
65
+
66
+ const id = await cognition.addFact({
67
+ type,
68
+ content: fact,
69
+ data: Object.keys(data).length > 0 ? data : undefined,
70
+ confidence,
71
+ });
72
+
73
+ updateOutput(
74
+ "toolCall",
75
+ JSON.stringify({
76
+ action: "Remember",
77
+ details: fact,
78
+ result: `Stored as ${type}`,
79
+ }),
80
+ { dontOverride: true },
81
+ );
82
+
83
+ return {
84
+ success: true,
85
+ id,
86
+ message: `Remembered: "${fact}" as ${type}`,
87
+ };
88
+ },
89
+ });
90
+
91
+ export default rememberTool;
@@ -0,0 +1,77 @@
1
+ import { tool } from "ai";
2
+ import { z } from "zod";
3
+ import pendingChanges from "@/agent/pendingChanges";
4
+ import useFraudeStore from "@/store/useFraudeStore";
5
+ import { exec } from "child_process";
6
+ import { promisify } from "util";
7
+
8
+ const execAsync = promisify(exec);
9
+ const { updateOutput } = useFraudeStore.getState();
10
+
11
+ const testRunnerTool = tool({
12
+ description: `Run a shell command to verify the codebase state, INCLUDING pending changes.
13
+ Crucial for testing changes before they are permanently applied.
14
+
15
+ HOW IT WORKS:
16
+ 1. Temporarily applies ALL pending changes to disk.
17
+ 2. Runs your command (e.g., 'bun test').
18
+ 3. IMMEDIATELY restores the file system to its previous state.
19
+
20
+ Use this to verify your changes actually work.`,
21
+ strict: true,
22
+ inputSchema: z.object({
23
+ command: z
24
+ .string()
25
+ .describe(
26
+ "The shell command to run (e.g., 'bun test tests/my.test.ts', 'python3 tests/test_app.py')",
27
+ ),
28
+ }),
29
+ execute: async ({ command }) => {
30
+ updateOutput(
31
+ "toolCall",
32
+ JSON.stringify({
33
+ action: "Running Test on Pending State",
34
+ details: command,
35
+ result: "...",
36
+ }),
37
+ { dontOverride: true },
38
+ );
39
+
40
+ try {
41
+ // 1. Apply Changes
42
+ await pendingChanges.applyAllTemporary();
43
+
44
+ // 2. Run Command
45
+ try {
46
+ const { stdout, stderr } = await execAsync(command);
47
+ const result = `STDOUT:\n${stdout}\n\nSTDERR:\n${stderr}`;
48
+
49
+ updateOutput(
50
+ "toolCall",
51
+ JSON.stringify({
52
+ action: "Test Result",
53
+ details: command,
54
+ result: stdout.slice(0, 100) + (stdout.length > 100 ? "..." : ""),
55
+ }),
56
+ );
57
+ return result;
58
+ } catch (error: any) {
59
+ const result = `Command Failed:\n${error.message}\n\nSTDOUT:\n${error.stdout}\n\nSTDERR:\n${error.stderr}`;
60
+ updateOutput(
61
+ "toolCall",
62
+ JSON.stringify({
63
+ action: "Test Failed",
64
+ details: command,
65
+ result: "Exit Code: " + error.code,
66
+ }),
67
+ );
68
+ return result;
69
+ }
70
+ } finally {
71
+ // 3. Restore State
72
+ await pendingChanges.restoreAll();
73
+ }
74
+ },
75
+ });
76
+
77
+ export default testRunnerTool;
@@ -0,0 +1,44 @@
1
+ import { tool } from "ai";
2
+ import { z } from "zod";
3
+ import useFraudeStore from "@/store/useFraudeStore";
4
+ import pendingChanges from "@/agent/pendingChanges";
5
+
6
+ const { updateOutput } = useFraudeStore.getState();
7
+
8
+ const testTool = tool({
9
+ description: `Create OR UPDATE a TEMPORARY test file to verify changes.
10
+ This file will NOT be saved to the project permanently and will NOT appear in the user's pending changes list.
11
+ Use this tool specifically when you want to create a reproduction script or a new test case to verify your changes without cluttering the project.
12
+ If you need to fix a mistake in the test file, simply call this tool again with the same path and the corrected content.`,
13
+ strict: true,
14
+ inputSchema: z.object({
15
+ path: z
16
+ .string()
17
+ .describe(
18
+ "The path to the temporary test file (e.g., 'tests/temp_repro.test.ts')",
19
+ ),
20
+ content: z.string().describe("The content of the test file"),
21
+ }),
22
+ execute: async ({ path, content }) => {
23
+ // Add change with hidden: true
24
+ const change = await pendingChanges.addChange(path, content, "write", {
25
+ hidden: true,
26
+ });
27
+
28
+ updateOutput(
29
+ "toolCall",
30
+ JSON.stringify({
31
+ action: "Created Temporary Test",
32
+ details: path,
33
+ result: "(Hidden from pending changes)",
34
+ }),
35
+ { dontOverride: true },
36
+ );
37
+ return {
38
+ success: true,
39
+ message: `Created temporary test at ${path}. You can now run it using testRunnerTool.`,
40
+ };
41
+ },
42
+ });
43
+
44
+ export default testTool;
@@ -0,0 +1,224 @@
1
+ import { tool } from "ai";
2
+ import { z } from "zod";
3
+ import path from "path";
4
+ import useFraudeStore from "@/store/useFraudeStore";
5
+ import DESCRIPTION from "./descriptions/todo.txt" with { type: "text" };
6
+
7
+ const { updateOutput } = useFraudeStore.getState();
8
+
9
+ // Path configuration
10
+ const FRAUDE_DIR = path.join(process.cwd(), ".fraude");
11
+ const TODOS_FILE = path.join(FRAUDE_DIR, "todos.json");
12
+
13
+ // Context for worker agents
14
+ interface TaskContext {
15
+ files: string[];
16
+ instructions: string;
17
+ }
18
+
19
+ // Todo item schema
20
+ export interface TodoItem {
21
+ id: string;
22
+ description: string;
23
+ status: "pending" | "in-progress" | "reviewing" | "completed";
24
+ context?: TaskContext;
25
+ notes: string[];
26
+ createdAt: string;
27
+ updatedAt: string;
28
+ }
29
+
30
+ interface TodoState {
31
+ todos: TodoItem[];
32
+ }
33
+
34
+ // Helper to read current todos
35
+ async function readTodos(): Promise<TodoState> {
36
+ const file = Bun.file(TODOS_FILE);
37
+ if (await file.exists()) {
38
+ const text = await file.text();
39
+ return JSON.parse(text);
40
+ }
41
+ return { todos: [] };
42
+ }
43
+
44
+ // Helper to write todos
45
+ async function writeTodos(state: TodoState): Promise<void> {
46
+ await Bun.write(TODOS_FILE, JSON.stringify(state, null, 2));
47
+ }
48
+
49
+ // Generate unique ID
50
+ function generateId(): string {
51
+ return Date.now().toString(36) + Math.random().toString(36).substr(2, 5);
52
+ }
53
+
54
+ const todoTool = tool({
55
+ description: DESCRIPTION,
56
+ strict: true,
57
+ inputSchema: z.object({
58
+ operation: z
59
+ .enum(["add", "update", "complete", "list", "clear"])
60
+ .describe("The operation to perform"),
61
+ id: z
62
+ .string()
63
+ .optional()
64
+ .describe("Task ID (required for update/complete)"),
65
+ description: z
66
+ .string()
67
+ .optional()
68
+ .describe("Task description (required for add)"),
69
+ context: z
70
+ .object({
71
+ files: z.array(z.string()).describe("Relevant file paths"),
72
+ instructions: z
73
+ .string()
74
+ .describe("Specific instructions for the worker"),
75
+ })
76
+ .optional()
77
+ .describe("Pre-researched context for the worker (for add)"),
78
+ status: z
79
+ .enum(["pending", "in-progress", "reviewing", "completed"])
80
+ .optional()
81
+ .describe("New status (for update)"),
82
+ note: z.string().optional().describe("Note to append"),
83
+ }),
84
+
85
+ execute: async ({ operation, id, description, context, status, note }) => {
86
+ const state = await readTodos();
87
+ const now = new Date().toISOString();
88
+
89
+ switch (operation) {
90
+ case "add": {
91
+ if (!description) throw new Error("Description required");
92
+ const newTodo: TodoItem = {
93
+ id: generateId(),
94
+ description,
95
+ status: "pending",
96
+ context,
97
+ notes: note ? [note] : [],
98
+ createdAt: now,
99
+ updatedAt: now,
100
+ };
101
+ state.todos.push(newTodo);
102
+ await writeTodos(state);
103
+ updateOutput(
104
+ "toolCall",
105
+ JSON.stringify({
106
+ action: "Added Task",
107
+ details: description,
108
+ result: newTodo.id,
109
+ }),
110
+ { dontOverride: true },
111
+ );
112
+ return { success: true, id: newTodo.id };
113
+ }
114
+
115
+ case "update": {
116
+ if (!id) throw new Error("ID required");
117
+ const todo = state.todos.find((t) => t.id === id);
118
+ if (!todo) throw new Error(`Task not found: ${id}`);
119
+ if (status) todo.status = status;
120
+ if (note) todo.notes.push(note);
121
+ todo.updatedAt = now;
122
+ await writeTodos(state);
123
+ updateOutput(
124
+ "toolCall",
125
+ JSON.stringify({
126
+ action: "Updated Task",
127
+ details: todo.description,
128
+ result: status || "note added",
129
+ }),
130
+ { dontOverride: true },
131
+ );
132
+ return { success: true };
133
+ }
134
+
135
+ case "complete": {
136
+ if (!id) throw new Error("ID required");
137
+ const todo = state.todos.find((t) => t.id === id);
138
+ if (!todo) throw new Error(`Task not found: ${id}`);
139
+ todo.status = "completed";
140
+ if (note) todo.notes.push(`[Done] ${note}`);
141
+ todo.updatedAt = now;
142
+ await writeTodos(state);
143
+ updateOutput(
144
+ "toolCall",
145
+ JSON.stringify({
146
+ action: "Completed Task",
147
+ details: todo.description,
148
+ result: "✓",
149
+ }),
150
+ { dontOverride: true },
151
+ );
152
+ return { success: true };
153
+ }
154
+
155
+ case "list": {
156
+ const summary = {
157
+ total: state.todos.length,
158
+ pending: state.todos.filter((t) => t.status === "pending").length,
159
+ inProgress: state.todos.filter((t) => t.status === "in-progress")
160
+ .length,
161
+ completed: state.todos.filter((t) => t.status === "completed").length,
162
+ };
163
+ updateOutput(
164
+ "toolCall",
165
+ JSON.stringify({
166
+ action: "Listed Tasks",
167
+ details: `${summary.pending} pending, ${summary.inProgress} in-progress`,
168
+ result: `${summary.total} total`,
169
+ }),
170
+ { dontOverride: true },
171
+ );
172
+ return { todos: state.todos, summary };
173
+ }
174
+
175
+ case "clear": {
176
+ const before = state.todos.length;
177
+ state.todos = state.todos.filter((t) => t.status !== "completed");
178
+ await writeTodos(state);
179
+ updateOutput(
180
+ "toolCall",
181
+ JSON.stringify({
182
+ action: "Cleared Completed",
183
+ details: `Removed ${before - state.todos.length} tasks`,
184
+ result: "✓",
185
+ }),
186
+ { dontOverride: true },
187
+ );
188
+ return { success: true, remaining: state.todos.length };
189
+ }
190
+ }
191
+ },
192
+ });
193
+
194
+ export const getNextTodo = async () => {
195
+ const state = await readTodos();
196
+ const nextTodo = state.todos.find((t) => t.status === "pending");
197
+ if (!nextTodo) {
198
+ return { done: true, task: null };
199
+ }
200
+ // Mark as in-progress
201
+ nextTodo.status = "in-progress";
202
+ nextTodo.updatedAt = new Date().toISOString();
203
+ await writeTodos(state);
204
+ return {
205
+ done: false,
206
+ task: nextTodo,
207
+ };
208
+ };
209
+
210
+ export const getTodoById = async (id: string) => {
211
+ const state = await readTodos();
212
+ return state.todos.find((t) => t.id === id);
213
+ };
214
+
215
+ /**
216
+ * Check if there are any pending todos without modifying state.
217
+ * Used to validate that the manager agent created tasks.
218
+ */
219
+ export const hasPendingTodos = async (): Promise<boolean> => {
220
+ const state = await readTodos();
221
+ return state.todos.some((t) => t.status === "pending");
222
+ };
223
+
224
+ export default todoTool;
@@ -0,0 +1,33 @@
1
+ import { tool } from "ai";
2
+ import { z } from "zod";
3
+ import useFraudeStore from "@/store/useFraudeStore";
4
+ import { projectPath } from "@/utils";
5
+ import pendingChanges from "@/agent/pendingChanges";
6
+
7
+ import DESCRIPTION from "./descriptions/write.txt" with { type: "text" };
8
+ const { updateOutput } = useFraudeStore.getState();
9
+
10
+ const writeTool = tool({
11
+ description: DESCRIPTION,
12
+ strict: true,
13
+ inputSchema: z.object({
14
+ path: z.string().describe("The path to the file to write"),
15
+ content: z.string().describe("The content to write to the file"),
16
+ }),
17
+ execute: async ({ path, content }) => {
18
+ const change = await pendingChanges.addChange(path, content, "write");
19
+ const stats = pendingChanges.getDiffStats(change.diff);
20
+ updateOutput(
21
+ "toolCall",
22
+ JSON.stringify({
23
+ action: "Created File",
24
+ details: path,
25
+ result: `(+${stats.added} / -${stats.removed})`,
26
+ }),
27
+ { dontOverride: true },
28
+ );
29
+ return { success: true };
30
+ },
31
+ });
32
+
33
+ export default writeTool;
@@ -0,0 +1,38 @@
1
+ import type { Command } from "../types/CommandDefinition";
2
+ import modelCommands from "./model";
3
+ import openRouterCommands from "./openrouter";
4
+ import cerebrasCommands from "./cerebras";
5
+ import groqCommands from "./groq";
6
+ import googleCommands from "./google";
7
+ import mistralCommands from "./mistral";
8
+ import modelsCommands from "./models";
9
+ import ollamaCommand from "./ollama";
10
+ import sessionCommands from "./session";
11
+ import usageCommand from "./usage";
12
+ import serveCommand from "./serve";
13
+ import logCommand from "./log";
14
+ import rememberCommand from "./remember";
15
+ import knowledgeCommand from "./knowledge";
16
+ import forgetCommand from "./forget";
17
+ import visualizeCommand from "./visualize";
18
+
19
+ const COMMANDS: Command[] = [
20
+ usageCommand,
21
+ logCommand,
22
+ serveCommand,
23
+ sessionCommands,
24
+ rememberCommand,
25
+ knowledgeCommand,
26
+ forgetCommand,
27
+ visualizeCommand,
28
+ modelCommands, //starts with model
29
+ modelsCommands, //starts with models
30
+ ollamaCommand,
31
+ openRouterCommands,
32
+ cerebrasCommands,
33
+ groqCommands,
34
+ googleCommands,
35
+ mistralCommands,
36
+ ];
37
+
38
+ export default COMMANDS;
@@ -0,0 +1,27 @@
1
+ import { UpdateSettings } from "src/config/settings";
2
+ import useFraudeStore from "src/store/useFraudeStore";
3
+ import CerebrasClient from "@/services/cerebras";
4
+ import type { Command } from "@/types/CommandDefinition";
5
+
6
+ const { updateOutput } = useFraudeStore.getState();
7
+
8
+ const cerebrasAuth = async (args: string[]) => {
9
+ const apiKey = args[0];
10
+ if (!apiKey) {
11
+ updateOutput("error", "No API key specified (Cerebras)");
12
+ return;
13
+ }
14
+ await UpdateSettings({ cerebras_api_key: apiKey });
15
+ updateOutput("log", "✓ Cerebras API key set");
16
+ await CerebrasClient.syncCerebrasModels();
17
+ updateOutput("log", "✓ Cerebras models synced");
18
+ };
19
+
20
+ const cerebrasAuthCommand: Command = {
21
+ name: "auth",
22
+ description: "Set Cerebras API key",
23
+ usage: "/cerebras auth <api-key>",
24
+ action: cerebrasAuth,
25
+ };
26
+
27
+ export default cerebrasAuthCommand;
@@ -0,0 +1,31 @@
1
+ import type { Command } from "@/types/CommandDefinition";
2
+ import cerebrasAuthCommand from "./auth";
3
+
4
+ import useFraudeStore from "@/store/useFraudeStore";
5
+
6
+ const { updateOutput } = useFraudeStore.getState();
7
+
8
+ const cerebrasCommands: Command = {
9
+ name: "cerebras",
10
+ description: "Manage Cerebras models",
11
+ usage: "/cerebras <subcommand>",
12
+ action: async (args: string[]) => {
13
+ if (args.length === 0 || args[0] === "list" || args[0] === "models") {
14
+ updateOutput("settings", "/models:cerebras");
15
+ return;
16
+ }
17
+ },
18
+ subcommands: [
19
+ cerebrasAuthCommand,
20
+ {
21
+ name: "list",
22
+ description: "List Cerebras models",
23
+ usage: "/cerebras list",
24
+ action: async () => {
25
+ updateOutput("settings", "/models:cerebras");
26
+ },
27
+ },
28
+ ],
29
+ };
30
+
31
+ export default cerebrasCommands;
@@ -0,0 +1,29 @@
1
+ import type { Command } from "@/types/CommandDefinition";
2
+ import AgentCognition from "@/utils/agentCognition";
3
+ import { resetLSPClient } from "@/utils/lspClient";
4
+ import useFraudeStore from "@/store/useFraudeStore";
5
+
6
+ const forgetCommand: Command = {
7
+ name: "forget",
8
+ description: "Reset the knowledge graph (clears all memories and embeddings)",
9
+ usage: "/forget",
10
+ action: async () => {
11
+ const { updateOutput } = useFraudeStore.getState();
12
+ try {
13
+ updateOutput("log", "Resetting knowledge graph and LSP cache...");
14
+
15
+ const cognition = AgentCognition.getInstance();
16
+ await cognition.reset();
17
+ resetLSPClient();
18
+
19
+ updateOutput(
20
+ "done",
21
+ "Knowledge graph has been successfully reset. All memories contain data for the current session only.",
22
+ );
23
+ } catch (error) {
24
+ updateOutput("error", `Error resetting knowledge graph: ${error}`);
25
+ }
26
+ },
27
+ };
28
+
29
+ export default forgetCommand;
@@ -0,0 +1,24 @@
1
+ import { UpdateSettings } from "src/config/settings";
2
+ import useFraudeStore from "src/store/useFraudeStore";
3
+ import type { Command } from "@/types/CommandDefinition";
4
+
5
+ const { updateOutput } = useFraudeStore.getState();
6
+
7
+ const googleAuth = async (args: string[]) => {
8
+ const apiKey = args[0];
9
+ if (!apiKey) {
10
+ updateOutput("error", "No API key specified (Google)");
11
+ return;
12
+ }
13
+ await UpdateSettings({ google_api_key: apiKey });
14
+ updateOutput("log", "✓ Google API key set");
15
+ };
16
+
17
+ const googleAuthCommand: Command = {
18
+ name: "auth",
19
+ description: "Set Google API key",
20
+ usage: "/google auth <api-key>",
21
+ action: googleAuth,
22
+ };
23
+
24
+ export default googleAuthCommand;
@@ -0,0 +1,31 @@
1
+ import type { Command } from "@/types/CommandDefinition";
2
+ import googleAuthCommand from "./auth";
3
+
4
+ import useFraudeStore from "@/store/useFraudeStore";
5
+
6
+ const { updateOutput } = useFraudeStore.getState();
7
+
8
+ const googleCommands: Command = {
9
+ name: "google",
10
+ description: "Manage Google models",
11
+ usage: "/google <subcommand>",
12
+ action: async (args: string[]) => {
13
+ if (args.length === 0 || args[0] === "list" || args[0] === "models") {
14
+ updateOutput("settings", "/models:google");
15
+ return;
16
+ }
17
+ },
18
+ subcommands: [
19
+ googleAuthCommand,
20
+ {
21
+ name: "list",
22
+ description: "List Google models",
23
+ usage: "/google list",
24
+ action: async () => {
25
+ updateOutput("settings", "/models:google");
26
+ },
27
+ },
28
+ ],
29
+ };
30
+
31
+ export default googleCommands;