raggiecode 0.2.1__py3-none-any.whl
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.
- Agent/__init__.py +0 -0
- Agent/agent.py +891 -0
- Agent/chat_history_db.py +1500 -0
- Agent/command.py +49 -0
- Agent/config.py +46 -0
- Agent/effort_levels.py +33 -0
- Agent/git_manager.py +727 -0
- Agent/tools.py +35 -0
- Commands/__init__.py +18 -0
- Commands/effort.py +42 -0
- Commands/global_todo.py +23 -0
- Commands/help.py +22 -0
- Commands/reasoning.py +24 -0
- Commands/redo.py +11 -0
- Commands/reindex.py +27 -0
- Commands/shell.py +28 -0
- Commands/stream.py +24 -0
- Commands/undo.py +13 -0
- Commands/unlimited_effort.py +8 -0
- Commands/window_size.py +29 -0
- RAG/__init__.py +0 -0
- RAG/document.py +119 -0
- RAG/find.py +408 -0
- RAG/graph.py +231 -0
- Tools/GetFileCodeStructure.py +43 -0
- Tools/GetSymbolSourceCode.py +27 -0
- Tools/__init__.py +39 -0
- Tools/ask_user.py +102 -0
- Tools/dispatch_subagent.py +215 -0
- Tools/document.py +35 -0
- Tools/edit_symbol.py +250 -0
- Tools/fuzzy_search.py +119 -0
- Tools/list_dir.py +51 -0
- Tools/read.py +49 -0
- Tools/read_image.py +75 -0
- Tools/remove.py +75 -0
- Tools/replace.py +305 -0
- Tools/search.py +41 -0
- Tools/shell.py +149 -0
- Tools/shell_kill.py +87 -0
- Tools/temp_background_service.py +113 -0
- Tools/todo_list.py +481 -0
- Tools/utils.py +116 -0
- Tools/view_changes.py +179 -0
- Tools/walk_call_tree.py +30 -0
- Tools/web_fetch.py +175 -0
- Tools/web_search.py +69 -0
- Tools/write.py +48 -0
- cli.py +111 -0
- config/__init__.py +0 -0
- config/coder_system_prompt.md +119 -0
- config/roles.json +43 -0
- config/tools.json +709 -0
- indexing/__init__.py +0 -0
- indexing/cli.py +128 -0
- indexing/code_index_sdk.py +832 -0
- indexing/code_indexer.py +1763 -0
- indexing/db_schema.py +396 -0
- indexing/export_to_json.py +346 -0
- indexing/extractors.py +189 -0
- indexing/file_utils.py +97 -0
- indexing/frontend/__init__.py +0 -0
- indexing/frontend/css_extractor.py +195 -0
- indexing/frontend/css_parser.py +387 -0
- indexing/frontend/css_selector_utils.py +226 -0
- indexing/frontend/edit_safety.py +573 -0
- indexing/frontend/graph.py +838 -0
- indexing/frontend/html_extractor.py +496 -0
- indexing/frontend/html_parser.py +314 -0
- indexing/frontend/jsx_extractor.py +1204 -0
- indexing/frontend/location_lookup.py +247 -0
- indexing/frontend/resolver.py +485 -0
- indexing/frontend/runtime_resolver.py +862 -0
- indexing/frontend/semantic_output.py +705 -0
- indexing/frontend/source_location.py +69 -0
- indexing/frontend_config.py +72 -0
- indexing/frontend_models.py +347 -0
- indexing/language_config.py +360 -0
- indexing/models.py +284 -0
- indexing/node_utils.py +1112 -0
- indexing/parse_worker.py +1082 -0
- indexing/queries.py +1542 -0
- indexing/sdk_examples.py +426 -0
- interactive.py +248 -0
- raggie.py +673 -0
- raggiecode-0.2.1.dist-info/METADATA +944 -0
- raggiecode-0.2.1.dist-info/RECORD +93 -0
- raggiecode-0.2.1.dist-info/WHEEL +5 -0
- raggiecode-0.2.1.dist-info/entry_points.txt +2 -0
- raggiecode-0.2.1.dist-info/top_level.txt +10 -0
- skills/__init__.py +3 -0
- skills/manager.py +114 -0
- skills/tool.py +121 -0
Agent/command.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
class CommandRegistry:
|
|
2
|
+
"""Registry for slash commands and other user-facing commands.
|
|
3
|
+
|
|
4
|
+
Commands are registered with a prefix (e.g. ``/undo``, ``!``) and a
|
|
5
|
+
handler function. When the user's prompt starts with a registered
|
|
6
|
+
prefix, the matching handler is invoked with the remaining argument
|
|
7
|
+
string and the agent instance.
|
|
8
|
+
|
|
9
|
+
Handler signature::
|
|
10
|
+
|
|
11
|
+
def handle(args: str, agent: Agent) -> str | None
|
|
12
|
+
|
|
13
|
+
*args* is everything after the prefix (stripped). Returning ``None``
|
|
14
|
+
signals that the command was a no-op (e.g. empty ``!`` with no command).
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(self):
|
|
18
|
+
self.commands = {}
|
|
19
|
+
|
|
20
|
+
def register(self, prefix, handler):
|
|
21
|
+
"""Register a command handler for a given prefix."""
|
|
22
|
+
self.commands[prefix] = handler
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# returns <bool>, <str>
|
|
26
|
+
# if bool is true the agent need to use <str> as prompt
|
|
27
|
+
# no action is needed form the agent and it will ignore the string
|
|
28
|
+
def try_handle(self, prompt, agent):
|
|
29
|
+
command = ""
|
|
30
|
+
args = ""
|
|
31
|
+
if len(prompt) >= 1 and prompt[0] == "!":
|
|
32
|
+
command = "!"
|
|
33
|
+
args = prompt[1:].strip()
|
|
34
|
+
elif not " " in prompt:
|
|
35
|
+
command = prompt
|
|
36
|
+
else:
|
|
37
|
+
command = prompt[:prompt.index(" ")]
|
|
38
|
+
args = prompt[prompt.index(" ") + 1:].strip()
|
|
39
|
+
|
|
40
|
+
handler = self.commands.get(command)
|
|
41
|
+
|
|
42
|
+
if handler == None:
|
|
43
|
+
return True, prompt # process normal prompts that does not match the rules must be processed by the agent
|
|
44
|
+
|
|
45
|
+
result = handler(args, agent)
|
|
46
|
+
if result == "":
|
|
47
|
+
return False, "" #do not serve the agent any prompt. what string you return do not matter here
|
|
48
|
+
else:
|
|
49
|
+
return True, result
|
Agent/config.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import shutil
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
# The user's config directory (~/.config/raggie)
|
|
6
|
+
USER_CONFIG_DIR = Path.home() / ".config" / "raggie"
|
|
7
|
+
|
|
8
|
+
# The default config directory in the source code
|
|
9
|
+
DEFAULT_CONFIG_DIR = Path(__file__).parent.parent / "config"
|
|
10
|
+
|
|
11
|
+
def ensure_config_exists(filename):
|
|
12
|
+
USER_CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
|
13
|
+
user_file = USER_CONFIG_DIR / filename
|
|
14
|
+
|
|
15
|
+
# If the user doesn't have the config file yet, copy it from the defaults
|
|
16
|
+
if not user_file.exists():
|
|
17
|
+
default_file = DEFAULT_CONFIG_DIR / filename
|
|
18
|
+
if default_file.exists():
|
|
19
|
+
shutil.copy2(default_file, user_file)
|
|
20
|
+
else:
|
|
21
|
+
# Fallback if somehow the default doesn't exist
|
|
22
|
+
user_file.write_text("{}")
|
|
23
|
+
|
|
24
|
+
return user_file
|
|
25
|
+
|
|
26
|
+
def load_roles():
|
|
27
|
+
config_file = ensure_config_exists("roles.json")
|
|
28
|
+
with open(config_file, "r") as f:
|
|
29
|
+
return json.load(f)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def save_roles(roles: dict):
|
|
33
|
+
"""Save roles dict to the user's roles.json file."""
|
|
34
|
+
config_file = ensure_config_exists("roles.json")
|
|
35
|
+
with open(config_file, "w") as f:
|
|
36
|
+
json.dump(roles, f, indent=4)
|
|
37
|
+
|
|
38
|
+
def load_tools():
|
|
39
|
+
config_file = ensure_config_exists("tools.json")
|
|
40
|
+
with open(config_file, "r") as f:
|
|
41
|
+
return json.load(f)
|
|
42
|
+
|
|
43
|
+
def load_keys():
|
|
44
|
+
config_file = ensure_config_exists("keys.json")
|
|
45
|
+
with open(config_file, "r") as f:
|
|
46
|
+
return json.load(f)
|
Agent/effort_levels.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
EFFORT_LEVELS = {
|
|
2
|
+
1: {"name": "Zen", "max_depth": 1},
|
|
3
|
+
2: {"name": "Serious", "max_depth": 2},
|
|
4
|
+
3: {"name": "Extreme", "max_depth": 4},
|
|
5
|
+
4: {"name": "Feral", "max_depth": 8},
|
|
6
|
+
5: {"name": "Insane", "max_depth": 16},
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
DEFAULT_EFFORT = 1
|
|
10
|
+
UNLIMITED_EFFORT = 99
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def effort_name(effort_num):
|
|
14
|
+
if effort_num == UNLIMITED_EFFORT:
|
|
15
|
+
return "Unlimited"
|
|
16
|
+
entry = EFFORT_LEVELS.get(effort_num)
|
|
17
|
+
if entry is None:
|
|
18
|
+
return "Unknown"
|
|
19
|
+
return entry["name"]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def effort_max_depth(effort_num):
|
|
23
|
+
entry = EFFORT_LEVELS.get(effort_num)
|
|
24
|
+
if entry is None:
|
|
25
|
+
return None
|
|
26
|
+
return entry["max_depth"]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def is_depth_allowed(effort_num, depth):
|
|
30
|
+
max_depth = effort_max_depth(effort_num)
|
|
31
|
+
if max_depth is None:
|
|
32
|
+
return True
|
|
33
|
+
return depth < max_depth
|