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,48 @@
1
+ import type { Command } from "@/types/CommandDefinition";
2
+ import useFraudeStore from "@/store/useFraudeStore";
3
+ import AgentCognition from "@/utils/agentCognition";
4
+
5
+ const rememberCommand: Command = {
6
+ name: "remember",
7
+ description: "Store a fact or decision",
8
+ usage: "/remember <content>",
9
+ action: async (args: string[]) => {
10
+ const { updateOutput } = useFraudeStore.getState();
11
+
12
+ if (args.length < 1) {
13
+ updateOutput("log", "Usage: /remember <content>");
14
+ return;
15
+ }
16
+
17
+ const type = "fact";
18
+
19
+ const content = args.join(" ");
20
+ if (content.length < 5) {
21
+ updateOutput(
22
+ "error",
23
+ "Content too short. Provide a meaningful description.",
24
+ );
25
+ return;
26
+ }
27
+
28
+ try {
29
+ const cognition = AgentCognition.getInstance();
30
+ await cognition.init();
31
+
32
+ const id = await cognition.addFact({
33
+ type: type as "decision" | "fact" | "concept" | "reference",
34
+ content,
35
+ confidence: 1.0,
36
+ });
37
+
38
+ updateOutput(
39
+ "log",
40
+ `✓ Remembered [${type}]: "${content.slice(0, 50)}..."`,
41
+ );
42
+ } catch (e) {
43
+ updateOutput("error", `Failed to store: ${e}`);
44
+ }
45
+ },
46
+ };
47
+
48
+ export default rememberCommand;
@@ -0,0 +1,31 @@
1
+ import { BunApiRouter } from "@/utils/router";
2
+ import type { Command } from "@/types/CommandDefinition";
3
+ import log from "@/utils/logger";
4
+ import useFraudeStore from "@/store/useFraudeStore";
5
+
6
+ const command: Command = {
7
+ name: "serve",
8
+ description: "Starts server to serve registered endpoints",
9
+ usage: "/serve <port>",
10
+ action: async (args: string[]) => {
11
+ const port = args[0] ? parseInt(args[0], 10) : 3000;
12
+
13
+ if (isNaN(port)) {
14
+ useFraudeStore.getState().updateOutput("error", "Invalid port number");
15
+ return;
16
+ }
17
+
18
+ log(`Starting server on port ${port}...`);
19
+ try {
20
+ await BunApiRouter.shared.serve(port);
21
+ log("Server stopped.");
22
+ } catch (error) {
23
+ log("Server error:", error);
24
+ useFraudeStore
25
+ .getState()
26
+ .updateOutput("error", `Server failed: ${error}`);
27
+ }
28
+ },
29
+ };
30
+
31
+ export default command;
@@ -0,0 +1,21 @@
1
+ import type { Command } from "@/types/CommandDefinition";
2
+ import useFraudeStore from "@/store/useFraudeStore";
3
+
4
+ const sessionCommand: Command = {
5
+ name: "session",
6
+ description: "Manage session",
7
+ usage: "/session <subcommand>",
8
+ subcommands: [
9
+ {
10
+ name: "clear",
11
+ description: "Clear current session",
12
+ usage: "/session clear",
13
+ action: async () => {
14
+ useFraudeStore.getState().contextManager.clearContext();
15
+ useFraudeStore.getState().updateOutput("log", "Session cleared");
16
+ },
17
+ },
18
+ ],
19
+ };
20
+
21
+ export default sessionCommand;
@@ -0,0 +1,15 @@
1
+ import type { Command } from "@/types/CommandDefinition";
2
+ import useFraudeStore from "@/store/useFraudeStore";
3
+
4
+ const { updateOutput } = useFraudeStore.getState();
5
+
6
+ const usageCommand: Command = {
7
+ name: "usage",
8
+ description: "Show usage information",
9
+ usage: "/usage",
10
+ action: async () => {
11
+ updateOutput("settings", "/usage");
12
+ },
13
+ };
14
+
15
+ export default usageCommand;