jarvis-ai-assistant 0.7.0__py3-none-any.whl → 0.7.6__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.
- jarvis/__init__.py +1 -1
- jarvis/jarvis_agent/__init__.py +243 -139
- jarvis/jarvis_agent/agent_manager.py +5 -10
- jarvis/jarvis_agent/builtin_input_handler.py +2 -6
- jarvis/jarvis_agent/config_editor.py +2 -7
- jarvis/jarvis_agent/event_bus.py +82 -12
- jarvis/jarvis_agent/file_context_handler.py +265 -15
- jarvis/jarvis_agent/file_methodology_manager.py +3 -4
- jarvis/jarvis_agent/jarvis.py +113 -98
- jarvis/jarvis_agent/language_extractors/__init__.py +57 -0
- jarvis/jarvis_agent/language_extractors/c_extractor.py +21 -0
- jarvis/jarvis_agent/language_extractors/cpp_extractor.py +21 -0
- jarvis/jarvis_agent/language_extractors/go_extractor.py +21 -0
- jarvis/jarvis_agent/language_extractors/java_extractor.py +84 -0
- jarvis/jarvis_agent/language_extractors/javascript_extractor.py +79 -0
- jarvis/jarvis_agent/language_extractors/python_extractor.py +21 -0
- jarvis/jarvis_agent/language_extractors/rust_extractor.py +21 -0
- jarvis/jarvis_agent/language_extractors/typescript_extractor.py +84 -0
- jarvis/jarvis_agent/language_support_info.py +486 -0
- jarvis/jarvis_agent/main.py +6 -12
- jarvis/jarvis_agent/memory_manager.py +7 -16
- jarvis/jarvis_agent/methodology_share_manager.py +10 -16
- jarvis/jarvis_agent/prompt_manager.py +1 -1
- jarvis/jarvis_agent/prompts.py +193 -171
- jarvis/jarvis_agent/protocols.py +8 -12
- jarvis/jarvis_agent/run_loop.py +77 -14
- jarvis/jarvis_agent/session_manager.py +2 -3
- jarvis/jarvis_agent/share_manager.py +12 -21
- jarvis/jarvis_agent/shell_input_handler.py +1 -2
- jarvis/jarvis_agent/task_analyzer.py +26 -4
- jarvis/jarvis_agent/task_manager.py +11 -27
- jarvis/jarvis_agent/tool_executor.py +2 -3
- jarvis/jarvis_agent/tool_share_manager.py +12 -24
- jarvis/jarvis_agent/web_server.py +55 -20
- jarvis/jarvis_c2rust/__init__.py +5 -5
- jarvis/jarvis_c2rust/cli.py +461 -499
- jarvis/jarvis_c2rust/collector.py +45 -53
- jarvis/jarvis_c2rust/constants.py +26 -0
- jarvis/jarvis_c2rust/library_replacer.py +264 -132
- jarvis/jarvis_c2rust/llm_module_agent.py +162 -190
- jarvis/jarvis_c2rust/loaders.py +207 -0
- jarvis/jarvis_c2rust/models.py +28 -0
- jarvis/jarvis_c2rust/optimizer.py +1592 -395
- jarvis/jarvis_c2rust/transpiler.py +1722 -1064
- jarvis/jarvis_c2rust/utils.py +385 -0
- jarvis/jarvis_code_agent/build_validation_config.py +2 -3
- jarvis/jarvis_code_agent/code_agent.py +394 -320
- jarvis/jarvis_code_agent/code_analyzer/__init__.py +3 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/base.py +4 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/cmake.py +17 -2
- jarvis/jarvis_code_agent/code_analyzer/build_validator/fallback.py +3 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/go.py +36 -4
- jarvis/jarvis_code_agent/code_analyzer/build_validator/java_gradle.py +9 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/java_maven.py +9 -0
- jarvis/jarvis_code_agent/code_analyzer/build_validator/makefile.py +12 -1
- jarvis/jarvis_code_agent/code_analyzer/build_validator/nodejs.py +22 -5
- jarvis/jarvis_code_agent/code_analyzer/build_validator/python.py +57 -32
- jarvis/jarvis_code_agent/code_analyzer/build_validator/rust.py +62 -6
- jarvis/jarvis_code_agent/code_analyzer/build_validator/validator.py +8 -9
- jarvis/jarvis_code_agent/code_analyzer/context_manager.py +290 -5
- jarvis/jarvis_code_agent/code_analyzer/language_support.py +21 -0
- jarvis/jarvis_code_agent/code_analyzer/languages/__init__.py +21 -3
- jarvis/jarvis_code_agent/code_analyzer/languages/c_cpp_language.py +72 -4
- jarvis/jarvis_code_agent/code_analyzer/languages/go_language.py +35 -3
- jarvis/jarvis_code_agent/code_analyzer/languages/java_language.py +212 -0
- jarvis/jarvis_code_agent/code_analyzer/languages/javascript_language.py +254 -0
- jarvis/jarvis_code_agent/code_analyzer/languages/python_language.py +52 -2
- jarvis/jarvis_code_agent/code_analyzer/languages/rust_language.py +73 -1
- jarvis/jarvis_code_agent/code_analyzer/languages/typescript_language.py +280 -0
- jarvis/jarvis_code_agent/code_analyzer/llm_context_recommender.py +306 -152
- jarvis/jarvis_code_agent/code_analyzer/structured_code.py +556 -0
- jarvis/jarvis_code_agent/code_analyzer/symbol_extractor.py +193 -18
- jarvis/jarvis_code_agent/code_analyzer/tree_sitter_extractor.py +18 -8
- jarvis/jarvis_code_agent/lint.py +258 -27
- jarvis/jarvis_code_agent/utils.py +0 -1
- jarvis/jarvis_code_analysis/code_review.py +19 -24
- jarvis/jarvis_data/config_schema.json +53 -26
- jarvis/jarvis_git_squash/main.py +4 -5
- jarvis/jarvis_git_utils/git_commiter.py +44 -49
- jarvis/jarvis_mcp/sse_mcp_client.py +20 -27
- jarvis/jarvis_mcp/stdio_mcp_client.py +11 -12
- jarvis/jarvis_mcp/streamable_mcp_client.py +15 -14
- jarvis/jarvis_memory_organizer/memory_organizer.py +55 -74
- jarvis/jarvis_methodology/main.py +32 -48
- jarvis/jarvis_multi_agent/__init__.py +79 -61
- jarvis/jarvis_multi_agent/main.py +3 -7
- jarvis/jarvis_platform/base.py +469 -199
- jarvis/jarvis_platform/human.py +7 -8
- jarvis/jarvis_platform/kimi.py +30 -36
- jarvis/jarvis_platform/openai.py +65 -27
- jarvis/jarvis_platform/registry.py +26 -10
- jarvis/jarvis_platform/tongyi.py +24 -25
- jarvis/jarvis_platform/yuanbao.py +31 -42
- jarvis/jarvis_platform_manager/main.py +66 -77
- jarvis/jarvis_platform_manager/service.py +8 -13
- jarvis/jarvis_rag/cli.py +49 -51
- jarvis/jarvis_rag/embedding_manager.py +13 -18
- jarvis/jarvis_rag/llm_interface.py +8 -9
- jarvis/jarvis_rag/query_rewriter.py +10 -21
- jarvis/jarvis_rag/rag_pipeline.py +24 -27
- jarvis/jarvis_rag/reranker.py +4 -5
- jarvis/jarvis_rag/retriever.py +28 -30
- jarvis/jarvis_sec/__init__.py +220 -3520
- jarvis/jarvis_sec/agents.py +143 -0
- jarvis/jarvis_sec/analysis.py +276 -0
- jarvis/jarvis_sec/cli.py +29 -6
- jarvis/jarvis_sec/clustering.py +1439 -0
- jarvis/jarvis_sec/file_manager.py +427 -0
- jarvis/jarvis_sec/parsers.py +73 -0
- jarvis/jarvis_sec/prompts.py +268 -0
- jarvis/jarvis_sec/report.py +83 -4
- jarvis/jarvis_sec/review.py +453 -0
- jarvis/jarvis_sec/utils.py +499 -0
- jarvis/jarvis_sec/verification.py +848 -0
- jarvis/jarvis_sec/workflow.py +7 -0
- jarvis/jarvis_smart_shell/main.py +38 -87
- jarvis/jarvis_stats/cli.py +1 -1
- jarvis/jarvis_stats/stats.py +7 -7
- jarvis/jarvis_stats/storage.py +15 -21
- jarvis/jarvis_tools/clear_memory.py +3 -20
- jarvis/jarvis_tools/cli/main.py +20 -23
- jarvis/jarvis_tools/edit_file.py +1066 -0
- jarvis/jarvis_tools/execute_script.py +42 -21
- jarvis/jarvis_tools/file_analyzer.py +6 -9
- jarvis/jarvis_tools/generate_new_tool.py +11 -20
- jarvis/jarvis_tools/lsp_client.py +1552 -0
- jarvis/jarvis_tools/methodology.py +2 -3
- jarvis/jarvis_tools/read_code.py +1525 -87
- jarvis/jarvis_tools/read_symbols.py +2 -3
- jarvis/jarvis_tools/read_webpage.py +7 -10
- jarvis/jarvis_tools/registry.py +370 -181
- jarvis/jarvis_tools/retrieve_memory.py +20 -19
- jarvis/jarvis_tools/rewrite_file.py +105 -0
- jarvis/jarvis_tools/save_memory.py +3 -15
- jarvis/jarvis_tools/search_web.py +3 -7
- jarvis/jarvis_tools/sub_agent.py +17 -6
- jarvis/jarvis_tools/sub_code_agent.py +14 -16
- jarvis/jarvis_tools/virtual_tty.py +54 -32
- jarvis/jarvis_utils/clipboard.py +7 -10
- jarvis/jarvis_utils/config.py +98 -63
- jarvis/jarvis_utils/embedding.py +5 -5
- jarvis/jarvis_utils/fzf.py +8 -8
- jarvis/jarvis_utils/git_utils.py +81 -67
- jarvis/jarvis_utils/input.py +24 -49
- jarvis/jarvis_utils/jsonnet_compat.py +465 -0
- jarvis/jarvis_utils/methodology.py +33 -35
- jarvis/jarvis_utils/utils.py +245 -202
- {jarvis_ai_assistant-0.7.0.dist-info → jarvis_ai_assistant-0.7.6.dist-info}/METADATA +205 -70
- jarvis_ai_assistant-0.7.6.dist-info/RECORD +218 -0
- jarvis/jarvis_agent/edit_file_handler.py +0 -584
- jarvis/jarvis_agent/rewrite_file_handler.py +0 -141
- jarvis/jarvis_agent/task_planner.py +0 -496
- jarvis/jarvis_platform/ai8.py +0 -332
- jarvis/jarvis_tools/ask_user.py +0 -54
- jarvis_ai_assistant-0.7.0.dist-info/RECORD +0 -192
- {jarvis_ai_assistant-0.7.0.dist-info → jarvis_ai_assistant-0.7.6.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.7.0.dist-info → jarvis_ai_assistant-0.7.6.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.7.0.dist-info → jarvis_ai_assistant-0.7.6.dist-info}/licenses/LICENSE +0 -0
- {jarvis_ai_assistant-0.7.0.dist-info → jarvis_ai_assistant-0.7.6.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""JavaScript language symbol extractor."""
|
|
3
|
+
|
|
4
|
+
from typing import Optional, Any, List
|
|
5
|
+
|
|
6
|
+
from jarvis.jarvis_agent.file_context_handler import register_language_extractor
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def create_javascript_extractor() -> Optional[Any]:
|
|
10
|
+
"""Create JavaScript symbol extractor using tree-sitter."""
|
|
11
|
+
try:
|
|
12
|
+
from tree_sitter import Language, Parser
|
|
13
|
+
import tree_sitter_javascript
|
|
14
|
+
from jarvis.jarvis_code_agent.code_analyzer.symbol_extractor import Symbol
|
|
15
|
+
|
|
16
|
+
JS_LANGUAGE = tree_sitter_javascript.language()
|
|
17
|
+
JS_SYMBOL_QUERY = """
|
|
18
|
+
(function_declaration
|
|
19
|
+
name: (identifier) @function.name)
|
|
20
|
+
|
|
21
|
+
(method_definition
|
|
22
|
+
name: (property_identifier) @method.name)
|
|
23
|
+
|
|
24
|
+
(class_declaration
|
|
25
|
+
name: (identifier) @class.name)
|
|
26
|
+
|
|
27
|
+
(variable_declaration
|
|
28
|
+
(variable_declarator
|
|
29
|
+
name: (identifier) @variable.name))
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
class JSSymbolExtractor:
|
|
33
|
+
def __init__(self):
|
|
34
|
+
# 如果传入的是 PyCapsule,需要转换为 Language 对象
|
|
35
|
+
if not isinstance(JS_LANGUAGE, Language):
|
|
36
|
+
self.language = Language(JS_LANGUAGE)
|
|
37
|
+
else:
|
|
38
|
+
self.language = JS_LANGUAGE
|
|
39
|
+
self.parser = Parser()
|
|
40
|
+
# 使用 language 属性而不是 set_language 方法
|
|
41
|
+
self.parser.language = self.language
|
|
42
|
+
self.symbol_query = JS_SYMBOL_QUERY
|
|
43
|
+
|
|
44
|
+
def extract_symbols(self, file_path: str, content: str) -> List[Any]:
|
|
45
|
+
try:
|
|
46
|
+
tree = self.parser.parse(bytes(content, "utf8"))
|
|
47
|
+
query = self.language.query(self.symbol_query)
|
|
48
|
+
captures = query.captures(tree.root_node)
|
|
49
|
+
|
|
50
|
+
symbols = []
|
|
51
|
+
for node, name in captures:
|
|
52
|
+
kind_map = {
|
|
53
|
+
"function.name": "function",
|
|
54
|
+
"method.name": "method",
|
|
55
|
+
"class.name": "class",
|
|
56
|
+
"variable.name": "variable",
|
|
57
|
+
}
|
|
58
|
+
symbol_kind = kind_map.get(name)
|
|
59
|
+
if symbol_kind:
|
|
60
|
+
symbols.append(Symbol(
|
|
61
|
+
name=node.text.decode('utf8'),
|
|
62
|
+
kind=symbol_kind,
|
|
63
|
+
file_path=file_path,
|
|
64
|
+
line_start=node.start_point[0] + 1,
|
|
65
|
+
line_end=node.end_point[0] + 1,
|
|
66
|
+
))
|
|
67
|
+
return symbols
|
|
68
|
+
except Exception:
|
|
69
|
+
return []
|
|
70
|
+
|
|
71
|
+
return JSSymbolExtractor()
|
|
72
|
+
except (ImportError, Exception):
|
|
73
|
+
return None
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def register_javascript_extractor() -> None:
|
|
77
|
+
"""Register JavaScript extractor for .js and .jsx files."""
|
|
78
|
+
register_language_extractor(['.js', '.jsx'], create_javascript_extractor)
|
|
79
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Python language symbol extractor."""
|
|
3
|
+
|
|
4
|
+
from typing import Optional, Any
|
|
5
|
+
|
|
6
|
+
from jarvis.jarvis_agent.file_context_handler import register_language_extractor
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def create_python_extractor() -> Optional[Any]:
|
|
10
|
+
"""Create Python symbol extractor using AST."""
|
|
11
|
+
try:
|
|
12
|
+
from jarvis.jarvis_code_agent.code_analyzer.languages.python_language import PythonSymbolExtractor
|
|
13
|
+
return PythonSymbolExtractor()
|
|
14
|
+
except (ImportError, Exception):
|
|
15
|
+
return None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def register_python_extractor() -> None:
|
|
19
|
+
"""Register Python extractor for .py and .pyw files."""
|
|
20
|
+
register_language_extractor(['.py', '.pyw'], create_python_extractor)
|
|
21
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Rust language symbol extractor."""
|
|
3
|
+
|
|
4
|
+
from typing import Optional, Any
|
|
5
|
+
|
|
6
|
+
from jarvis.jarvis_agent.file_context_handler import register_language_extractor
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def create_rust_extractor() -> Optional[Any]:
|
|
10
|
+
"""Create Rust symbol extractor using tree-sitter."""
|
|
11
|
+
try:
|
|
12
|
+
from jarvis.jarvis_code_agent.code_analyzer.languages.rust_language import RustSymbolExtractor
|
|
13
|
+
return RustSymbolExtractor()
|
|
14
|
+
except (ImportError, RuntimeError, Exception):
|
|
15
|
+
return None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def register_rust_extractor() -> None:
|
|
19
|
+
"""Register Rust extractor for .rs files."""
|
|
20
|
+
register_language_extractor('.rs', create_rust_extractor)
|
|
21
|
+
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""TypeScript language symbol extractor."""
|
|
3
|
+
|
|
4
|
+
from typing import Optional, Any, List
|
|
5
|
+
|
|
6
|
+
from jarvis.jarvis_agent.file_context_handler import register_language_extractor
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def create_typescript_extractor() -> Optional[Any]:
|
|
10
|
+
"""Create TypeScript symbol extractor using tree-sitter."""
|
|
11
|
+
try:
|
|
12
|
+
from tree_sitter import Language, Parser
|
|
13
|
+
import tree_sitter_typescript
|
|
14
|
+
from jarvis.jarvis_code_agent.code_analyzer.symbol_extractor import Symbol
|
|
15
|
+
|
|
16
|
+
# tree-sitter-typescript 使用 language_typescript() 和 language_tsx()
|
|
17
|
+
TS_LANGUAGE = tree_sitter_typescript.language_typescript()
|
|
18
|
+
TS_SYMBOL_QUERY = """
|
|
19
|
+
(function_declaration
|
|
20
|
+
name: (identifier) @function.name)
|
|
21
|
+
|
|
22
|
+
(method_definition
|
|
23
|
+
name: (property_identifier) @method.name)
|
|
24
|
+
|
|
25
|
+
(class_declaration
|
|
26
|
+
name: (type_identifier) @class.name)
|
|
27
|
+
|
|
28
|
+
(interface_declaration
|
|
29
|
+
name: (type_identifier) @interface.name)
|
|
30
|
+
|
|
31
|
+
(variable_declaration
|
|
32
|
+
(variable_declarator
|
|
33
|
+
name: (identifier) @variable.name))
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
class TSSymbolExtractor:
|
|
37
|
+
def __init__(self):
|
|
38
|
+
# 如果传入的是 PyCapsule,需要转换为 Language 对象
|
|
39
|
+
if not isinstance(TS_LANGUAGE, Language):
|
|
40
|
+
self.language = Language(TS_LANGUAGE)
|
|
41
|
+
else:
|
|
42
|
+
self.language = TS_LANGUAGE
|
|
43
|
+
self.parser = Parser()
|
|
44
|
+
# 使用 language 属性而不是 set_language 方法
|
|
45
|
+
self.parser.language = self.language
|
|
46
|
+
self.symbol_query = TS_SYMBOL_QUERY
|
|
47
|
+
|
|
48
|
+
def extract_symbols(self, file_path: str, content: str) -> List[Any]:
|
|
49
|
+
try:
|
|
50
|
+
tree = self.parser.parse(bytes(content, "utf8"))
|
|
51
|
+
query = self.language.query(self.symbol_query)
|
|
52
|
+
captures = query.captures(tree.root_node)
|
|
53
|
+
|
|
54
|
+
symbols = []
|
|
55
|
+
for node, name in captures:
|
|
56
|
+
kind_map = {
|
|
57
|
+
"function.name": "function",
|
|
58
|
+
"method.name": "method",
|
|
59
|
+
"class.name": "class",
|
|
60
|
+
"interface.name": "interface",
|
|
61
|
+
"variable.name": "variable",
|
|
62
|
+
}
|
|
63
|
+
symbol_kind = kind_map.get(name)
|
|
64
|
+
if symbol_kind:
|
|
65
|
+
symbols.append(Symbol(
|
|
66
|
+
name=node.text.decode('utf8'),
|
|
67
|
+
kind=symbol_kind,
|
|
68
|
+
file_path=file_path,
|
|
69
|
+
line_start=node.start_point[0] + 1,
|
|
70
|
+
line_end=node.end_point[0] + 1,
|
|
71
|
+
))
|
|
72
|
+
return symbols
|
|
73
|
+
except Exception:
|
|
74
|
+
return []
|
|
75
|
+
|
|
76
|
+
return TSSymbolExtractor()
|
|
77
|
+
except (ImportError, Exception):
|
|
78
|
+
return None
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def register_typescript_extractor() -> None:
|
|
82
|
+
"""Register TypeScript extractor for .ts and .tsx files."""
|
|
83
|
+
register_language_extractor(['.ts', '.tsx'], create_typescript_extractor)
|
|
84
|
+
|