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.
- package/README.md +68 -0
- package/dist/index.js +179297 -0
- package/package.json +88 -0
- package/src/agent/agent.ts +475 -0
- package/src/agent/contextManager.ts +141 -0
- package/src/agent/index.ts +14 -0
- package/src/agent/pendingChanges.ts +270 -0
- package/src/agent/prompts/AskPrompt.txt +10 -0
- package/src/agent/prompts/FastPrompt.txt +40 -0
- package/src/agent/prompts/PlannerPrompt.txt +51 -0
- package/src/agent/prompts/ReviewerPrompt.txt +57 -0
- package/src/agent/prompts/WorkerPrompt.txt +33 -0
- package/src/agent/subagents/askAgent.ts +37 -0
- package/src/agent/subagents/extractionAgent.ts +123 -0
- package/src/agent/subagents/fastAgent.ts +45 -0
- package/src/agent/subagents/managerAgent.ts +36 -0
- package/src/agent/subagents/relationAgent.ts +76 -0
- package/src/agent/subagents/researchSubAgent.ts +79 -0
- package/src/agent/subagents/reviewerSubAgent.ts +42 -0
- package/src/agent/subagents/workerSubAgent.ts +42 -0
- package/src/agent/tools/bashTool.ts +94 -0
- package/src/agent/tools/descriptions/bash.txt +47 -0
- package/src/agent/tools/descriptions/edit.txt +7 -0
- package/src/agent/tools/descriptions/glob.txt +4 -0
- package/src/agent/tools/descriptions/grep.txt +8 -0
- package/src/agent/tools/descriptions/lsp.txt +20 -0
- package/src/agent/tools/descriptions/plan.txt +3 -0
- package/src/agent/tools/descriptions/read.txt +9 -0
- package/src/agent/tools/descriptions/todo.txt +12 -0
- package/src/agent/tools/descriptions/write.txt +8 -0
- package/src/agent/tools/editTool.ts +44 -0
- package/src/agent/tools/globTool.ts +59 -0
- package/src/agent/tools/grepTool.ts +343 -0
- package/src/agent/tools/lspTool.ts +429 -0
- package/src/agent/tools/planTool.ts +118 -0
- package/src/agent/tools/readTool.ts +78 -0
- package/src/agent/tools/rememberTool.ts +91 -0
- package/src/agent/tools/testRunnerTool.ts +77 -0
- package/src/agent/tools/testTool.ts +44 -0
- package/src/agent/tools/todoTool.ts +224 -0
- package/src/agent/tools/writeTool.ts +33 -0
- package/src/commands/COMMANDS.ts +38 -0
- package/src/commands/cerebras/auth.ts +27 -0
- package/src/commands/cerebras/index.ts +31 -0
- package/src/commands/forget.ts +29 -0
- package/src/commands/google/auth.ts +24 -0
- package/src/commands/google/index.ts +31 -0
- package/src/commands/groq/add_model.ts +60 -0
- package/src/commands/groq/auth.ts +24 -0
- package/src/commands/groq/index.ts +33 -0
- package/src/commands/index.ts +65 -0
- package/src/commands/knowledge.ts +92 -0
- package/src/commands/log.ts +32 -0
- package/src/commands/mistral/auth.ts +27 -0
- package/src/commands/mistral/index.ts +31 -0
- package/src/commands/model/index.ts +145 -0
- package/src/commands/models/index.ts +16 -0
- package/src/commands/ollama/index.ts +29 -0
- package/src/commands/openrouter/add_model.ts +64 -0
- package/src/commands/openrouter/auth.ts +24 -0
- package/src/commands/openrouter/index.ts +33 -0
- package/src/commands/remember.ts +48 -0
- package/src/commands/serve.ts +31 -0
- package/src/commands/session/index.ts +21 -0
- package/src/commands/usage.ts +15 -0
- package/src/commands/visualize.ts +773 -0
- package/src/components/App.tsx +55 -0
- package/src/components/IntroComponent.tsx +70 -0
- package/src/components/LoaderComponent.tsx +68 -0
- package/src/components/OutputRenderer.tsx +88 -0
- package/src/components/SettingsRenderer.tsx +23 -0
- package/src/components/input/CommandSuggestions.tsx +41 -0
- package/src/components/input/FileSuggestions.tsx +61 -0
- package/src/components/input/InputBox.tsx +371 -0
- package/src/components/output/CheckpointView.tsx +13 -0
- package/src/components/output/CommandView.tsx +13 -0
- package/src/components/output/CommentView.tsx +12 -0
- package/src/components/output/ConfirmationView.tsx +179 -0
- package/src/components/output/ContextUsage.tsx +62 -0
- package/src/components/output/DiffView.tsx +202 -0
- package/src/components/output/ErrorView.tsx +14 -0
- package/src/components/output/InteractiveServerView.tsx +69 -0
- package/src/components/output/KnowledgeView.tsx +220 -0
- package/src/components/output/MarkdownView.tsx +15 -0
- package/src/components/output/ModelSelectView.tsx +71 -0
- package/src/components/output/ReasoningView.tsx +21 -0
- package/src/components/output/ToolCallView.tsx +45 -0
- package/src/components/settings/ModelList.tsx +250 -0
- package/src/components/settings/TokenUsage.tsx +274 -0
- package/src/config/schema.ts +19 -0
- package/src/config/settings.ts +229 -0
- package/src/index.tsx +100 -0
- package/src/parsers/tree-sitter-python.wasm +0 -0
- package/src/providers/providers.ts +71 -0
- package/src/services/PluginLoader.ts +123 -0
- package/src/services/cerebras.ts +69 -0
- package/src/services/embeddingService.ts +229 -0
- package/src/services/google.ts +65 -0
- package/src/services/graphSerializer.ts +248 -0
- package/src/services/groq.ts +23 -0
- package/src/services/knowledgeOrchestrator.ts +286 -0
- package/src/services/mistral.ts +79 -0
- package/src/services/ollama.ts +109 -0
- package/src/services/openrouter.ts +23 -0
- package/src/services/symbolExtractor.ts +277 -0
- package/src/store/useFraudeStore.ts +123 -0
- package/src/store/useSettingsStore.ts +38 -0
- package/src/theme.ts +26 -0
- package/src/types/Agent.ts +147 -0
- package/src/types/CommandDefinition.ts +8 -0
- package/src/types/Model.ts +94 -0
- package/src/types/OutputItem.ts +24 -0
- package/src/types/PluginContext.ts +55 -0
- package/src/types/TokenUsage.ts +5 -0
- package/src/types/assets.d.ts +4 -0
- package/src/utils/agentCognition.ts +1152 -0
- package/src/utils/fileSuggestions.ts +111 -0
- package/src/utils/index.ts +17 -0
- package/src/utils/initFraude.ts +8 -0
- package/src/utils/logger.ts +24 -0
- package/src/utils/lspClient.ts +1415 -0
- package/src/utils/paths.ts +24 -0
- package/src/utils/queryHandler.ts +227 -0
- package/src/utils/router.ts +278 -0
- package/src/utils/streamHandler.ts +132 -0
- package/src/utils/treeSitterQueries.ts +125 -0
- package/tsconfig.json +33 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const ModelSchema = z.object({
|
|
4
|
+
type: z.string().default("ollama"),
|
|
5
|
+
name: z.string(),
|
|
6
|
+
modified_at: z.string().optional().default(new Date().toISOString()),
|
|
7
|
+
size: z.number().optional(),
|
|
8
|
+
digest: z.string().optional().default(""),
|
|
9
|
+
capabilities: z.array(z.string()).optional(),
|
|
10
|
+
usage: z
|
|
11
|
+
.object({
|
|
12
|
+
promptTokens: z.number().default(0),
|
|
13
|
+
completionTokens: z.number().default(0),
|
|
14
|
+
totalTokens: z.number().default(0),
|
|
15
|
+
})
|
|
16
|
+
.default({
|
|
17
|
+
promptTokens: 0,
|
|
18
|
+
completionTokens: 0,
|
|
19
|
+
totalTokens: 0,
|
|
20
|
+
}),
|
|
21
|
+
details: z
|
|
22
|
+
.object({
|
|
23
|
+
format: z.string().optional(),
|
|
24
|
+
family: z.string().optional(),
|
|
25
|
+
families: z.array(z.string()).optional(),
|
|
26
|
+
parameter_size: z.string().optional(),
|
|
27
|
+
quantization_level: z.string().optional(),
|
|
28
|
+
context_length: z.number().optional(),
|
|
29
|
+
})
|
|
30
|
+
.catchall(z.any())
|
|
31
|
+
.optional()
|
|
32
|
+
.default({}),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export type Model = z.infer<typeof ModelSchema>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Creates a display identifier for a model that includes the provider
|
|
39
|
+
* Format: "modelName (provider)"
|
|
40
|
+
* Example: "openai/gpt-oss-120b (openrouter)"
|
|
41
|
+
*/
|
|
42
|
+
export function getModelDisplayId(model: Model): string {
|
|
43
|
+
return `${model.name} (${model.type})`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Creates a display identifier from name and type
|
|
48
|
+
*/
|
|
49
|
+
export function createModelDisplayId(name: string, type: string): string {
|
|
50
|
+
return `${name} (${type})`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Parses a display identifier back to name and type
|
|
55
|
+
* Returns null if the format is invalid
|
|
56
|
+
*/
|
|
57
|
+
export function parseModelDisplayId(
|
|
58
|
+
displayId: string,
|
|
59
|
+
): { name: string; type: string } | null {
|
|
60
|
+
// Match pattern: "name (provider)"
|
|
61
|
+
const match = displayId.match(/^(.+)\s+\((\w+)\)$/);
|
|
62
|
+
if (!match || !match[1] || !match[2]) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const name = match[1];
|
|
67
|
+
const type = match[2];
|
|
68
|
+
|
|
69
|
+
return { name, type };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Generates a unique ID for storing model references
|
|
74
|
+
* Format: "name|type"
|
|
75
|
+
*/
|
|
76
|
+
export function getModelUniqueId(model: Model): string {
|
|
77
|
+
return `${model.name}|${model.type}`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Parses a unique ID back to name and type
|
|
82
|
+
*/
|
|
83
|
+
export function parseModelUniqueId(
|
|
84
|
+
uniqueId: string,
|
|
85
|
+
): { name: string; type: string } | null {
|
|
86
|
+
const parts = uniqueId.split("|");
|
|
87
|
+
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const [name, type] = parts;
|
|
92
|
+
|
|
93
|
+
return { name, type };
|
|
94
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type OutputItemType =
|
|
2
|
+
| "log"
|
|
3
|
+
| "markdown"
|
|
4
|
+
| "diff"
|
|
5
|
+
| "confirmation"
|
|
6
|
+
| "command"
|
|
7
|
+
| "done"
|
|
8
|
+
| "settings"
|
|
9
|
+
| "comment"
|
|
10
|
+
| "error"
|
|
11
|
+
| "reasoning"
|
|
12
|
+
| "interrupted"
|
|
13
|
+
| "toolCall"
|
|
14
|
+
| "agentText"
|
|
15
|
+
| "modelSelect"
|
|
16
|
+
| "knowledge"
|
|
17
|
+
| "interactive-server";
|
|
18
|
+
|
|
19
|
+
export interface OutputItem {
|
|
20
|
+
id: string;
|
|
21
|
+
type: OutputItemType;
|
|
22
|
+
content: string;
|
|
23
|
+
duration?: number;
|
|
24
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { BunApiRouter } from "@/utils/router";
|
|
2
|
+
import type { Command } from "./CommandDefinition";
|
|
3
|
+
import Agent from "@/agent/agent";
|
|
4
|
+
|
|
5
|
+
export interface PluginContext {
|
|
6
|
+
/**
|
|
7
|
+
* Shared Router instance for registering endpoints
|
|
8
|
+
*/
|
|
9
|
+
router: BunApiRouter;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Application logger
|
|
13
|
+
*/
|
|
14
|
+
log: (...args: any[]) => void;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Router class for creating API endpoints
|
|
18
|
+
*/
|
|
19
|
+
Router: typeof BunApiRouter;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The Agent class definition (constructor)
|
|
23
|
+
*/
|
|
24
|
+
Agent: typeof Agent;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Settings management
|
|
28
|
+
*/
|
|
29
|
+
settings: {
|
|
30
|
+
get: (key: string) => any;
|
|
31
|
+
getAll: () => any;
|
|
32
|
+
update: (updates: any) => Promise<void>;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* UI / Store interaction
|
|
37
|
+
*/
|
|
38
|
+
ui: {
|
|
39
|
+
updateOutput: (
|
|
40
|
+
type: "command" | "markdown" | "log" | "error",
|
|
41
|
+
content: string,
|
|
42
|
+
) => void;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Global utilities (optional, e.g. if we want to expose 3rd party libs)
|
|
47
|
+
*/
|
|
48
|
+
utils: {
|
|
49
|
+
// Add common utilities here if needed
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type PluginInit = (
|
|
54
|
+
context: PluginContext,
|
|
55
|
+
) => Promise<Command | Command[]> | Command | Command[];
|