jarvis-ai-assistant 0.4.0__py3-none-any.whl → 0.4.2__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 +95 -74
- jarvis/jarvis_agent/agent_manager.py +6 -4
- jarvis/jarvis_agent/edit_file_handler.py +2 -2
- jarvis/jarvis_agent/jarvis.py +40 -9
- jarvis/jarvis_agent/rewrite_file_handler.py +143 -0
- jarvis/jarvis_agent/run_loop.py +23 -4
- jarvis/jarvis_agent/utils.py +5 -1
- jarvis/jarvis_agent/web_server.py +332 -234
- jarvis/jarvis_code_agent/code_agent.py +10 -7
- jarvis/jarvis_code_analysis/code_review.py +0 -1
- jarvis/jarvis_data/config_schema.json +10 -0
- jarvis/jarvis_multi_agent/__init__.py +227 -34
- jarvis/jarvis_multi_agent/main.py +10 -1
- jarvis/jarvis_platform/base.py +15 -6
- jarvis/jarvis_tools/registry.py +6 -0
- jarvis/jarvis_tools/sub_agent.py +19 -34
- jarvis/jarvis_tools/sub_code_agent.py +3 -1
- jarvis/jarvis_utils/config.py +26 -11
- jarvis/jarvis_utils/input.py +77 -6
- {jarvis_ai_assistant-0.4.0.dist-info → jarvis_ai_assistant-0.4.2.dist-info}/METADATA +1 -1
- {jarvis_ai_assistant-0.4.0.dist-info → jarvis_ai_assistant-0.4.2.dist-info}/RECORD +26 -28
- jarvis/jarvis_agent/config.py +0 -99
- jarvis/jarvis_tools/edit_file.py +0 -208
- jarvis/jarvis_tools/rewrite_file.py +0 -191
- {jarvis_ai_assistant-0.4.0.dist-info → jarvis_ai_assistant-0.4.2.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.4.0.dist-info → jarvis_ai_assistant-0.4.2.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.4.0.dist-info → jarvis_ai_assistant-0.4.2.dist-info}/licenses/LICENSE +0 -0
- {jarvis_ai_assistant-0.4.0.dist-info → jarvis_ai_assistant-0.4.2.dist-info}/top_level.txt +0 -0
jarvis/jarvis_tools/sub_agent.py
CHANGED
|
@@ -5,7 +5,7 @@ sub_agent 工具
|
|
|
5
5
|
|
|
6
6
|
约定:
|
|
7
7
|
- 必填参数:task, name, background, system_prompt, summary_prompt, use_tools
|
|
8
|
-
- 继承父 Agent 的部分配置:model_group、input_handler、execute_tool_confirm、multiline_inputer;其他参数需显式提供
|
|
8
|
+
- 继承父 Agent 的部分配置:model_group、input_handler、execute_tool_confirm、multiline_inputer、non_interactive、use_methodology、use_analysis;其他参数需显式提供
|
|
9
9
|
- 子Agent必须自动完成(auto_complete=True)且需要summary(need_summary=True)
|
|
10
10
|
"""
|
|
11
11
|
from typing import Any, Dict, List
|
|
@@ -27,7 +27,7 @@ class SubAgentTool:
|
|
|
27
27
|
|
|
28
28
|
# 必须与文件名一致,供 ToolRegistry 自动注册
|
|
29
29
|
name = "sub_agent"
|
|
30
|
-
description = "将子任务交给通用 Agent 执行,并返回执行结果(继承父Agent部分配置:model_group、input_handler、execute_tool_confirm、multiline_inputer;其他参数需显式提供,自动完成并生成总结)。"
|
|
30
|
+
description = "将子任务交给通用 Agent 执行,并返回执行结果(继承父Agent部分配置:model_group、input_handler、execute_tool_confirm、multiline_inputer、non_interactive、use_methodology、use_analysis;其他参数需显式提供,自动完成并生成总结)。"
|
|
31
31
|
parameters = {
|
|
32
32
|
"type": "object",
|
|
33
33
|
"properties": {
|
|
@@ -51,16 +51,9 @@ class SubAgentTool:
|
|
|
51
51
|
"type": "string",
|
|
52
52
|
"description": "覆盖子Agent的总结提示词(必填)",
|
|
53
53
|
},
|
|
54
|
-
"
|
|
55
|
-
"type": "
|
|
56
|
-
"
|
|
57
|
-
"description": "限制子Agent可用的工具名称列表(必填)。兼容以逗号分隔的字符串输入。可用的工具列表:"
|
|
58
|
-
+ "\n".join(
|
|
59
|
-
[
|
|
60
|
-
t["name"] + ": " + t["description"]
|
|
61
|
-
for t in ToolRegistry().get_all_tools()
|
|
62
|
-
]
|
|
63
|
-
),
|
|
54
|
+
"non_interactive": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"description": "是否启用无交互模式(可选,默认继承父Agent或系统默认)",
|
|
64
57
|
},
|
|
65
58
|
},
|
|
66
59
|
"required": [
|
|
@@ -69,7 +62,6 @@ class SubAgentTool:
|
|
|
69
62
|
"background",
|
|
70
63
|
"system_prompt",
|
|
71
64
|
"summary_prompt",
|
|
72
|
-
"use_tools",
|
|
73
65
|
],
|
|
74
66
|
}
|
|
75
67
|
|
|
@@ -105,16 +97,6 @@ class SubAgentTool:
|
|
|
105
97
|
summary_prompt = str(args.get("summary_prompt", "")).strip()
|
|
106
98
|
agent_name = str(args.get("name", "")).strip()
|
|
107
99
|
|
|
108
|
-
# 解析可用工具列表(支持数组或以逗号分隔的字符串)
|
|
109
|
-
_use_tools = args.get("use_tools", None)
|
|
110
|
-
use_tools: List[str] = []
|
|
111
|
-
if isinstance(_use_tools, list):
|
|
112
|
-
use_tools = [str(x).strip() for x in _use_tools if str(x).strip()]
|
|
113
|
-
elif isinstance(_use_tools, str):
|
|
114
|
-
use_tools = [s.strip() for s in _use_tools.split(",") if s.strip()]
|
|
115
|
-
else:
|
|
116
|
-
use_tools = []
|
|
117
|
-
|
|
118
100
|
errors = []
|
|
119
101
|
if not system_prompt:
|
|
120
102
|
errors.append("system_prompt 不能为空")
|
|
@@ -122,8 +104,6 @@ class SubAgentTool:
|
|
|
122
104
|
errors.append("summary_prompt 不能为空")
|
|
123
105
|
if not agent_name:
|
|
124
106
|
errors.append("name 不能为空")
|
|
125
|
-
if not use_tools:
|
|
126
|
-
errors.append("use_tools 不能为空")
|
|
127
107
|
if not background:
|
|
128
108
|
errors.append("background 不能为空")
|
|
129
109
|
|
|
@@ -139,16 +119,27 @@ class SubAgentTool:
|
|
|
139
119
|
parent_model_group = None
|
|
140
120
|
parent_execute_tool_confirm = None
|
|
141
121
|
parent_multiline_inputer = None
|
|
122
|
+
parent_non_interactive = None
|
|
123
|
+
parent_use_methodology = None
|
|
124
|
+
parent_use_analysis = None
|
|
142
125
|
try:
|
|
143
126
|
if parent_agent is not None:
|
|
144
127
|
if getattr(parent_agent, "model", None):
|
|
145
128
|
parent_model_group = getattr(parent_agent.model, "model_group", None)
|
|
146
129
|
parent_execute_tool_confirm = getattr(parent_agent, "execute_tool_confirm", None)
|
|
147
130
|
parent_multiline_inputer = getattr(parent_agent, "multiline_inputer", None)
|
|
131
|
+
parent_non_interactive = getattr(parent_agent, "non_interactive", None)
|
|
132
|
+
parent_use_methodology = getattr(parent_agent, "use_methodology", None)
|
|
133
|
+
parent_use_analysis = getattr(parent_agent, "use_analysis", None)
|
|
148
134
|
except Exception:
|
|
149
135
|
# 安全兜底:无法从父Agent获取配置则保持为None,使用系统默认
|
|
150
136
|
pass
|
|
151
137
|
|
|
138
|
+
# 可选参数:允许显式覆盖无交互模式
|
|
139
|
+
explicit_non_interactive = args.get("non_interactive", None)
|
|
140
|
+
if explicit_non_interactive is not None:
|
|
141
|
+
parent_non_interactive = bool(explicit_non_interactive)
|
|
142
|
+
|
|
152
143
|
agent = Agent(
|
|
153
144
|
system_prompt=system_prompt,
|
|
154
145
|
name=agent_name,
|
|
@@ -156,23 +147,17 @@ class SubAgentTool:
|
|
|
156
147
|
model_group=parent_model_group,
|
|
157
148
|
summary_prompt=summary_prompt,
|
|
158
149
|
auto_complete=auto_complete,
|
|
159
|
-
output_handler=None,
|
|
160
150
|
use_tools=None,
|
|
161
151
|
execute_tool_confirm=parent_execute_tool_confirm,
|
|
162
152
|
need_summary=need_summary,
|
|
163
153
|
multiline_inputer=parent_multiline_inputer,
|
|
164
|
-
use_methodology=
|
|
165
|
-
use_analysis=
|
|
154
|
+
use_methodology=parent_use_methodology,
|
|
155
|
+
use_analysis=parent_use_analysis,
|
|
166
156
|
force_save_memory=None,
|
|
167
157
|
files=None,
|
|
158
|
+
non_interactive=parent_non_interactive,
|
|
168
159
|
)
|
|
169
160
|
|
|
170
|
-
# 设置可用工具列表
|
|
171
|
-
try:
|
|
172
|
-
agent.set_use_tools(use_tools)
|
|
173
|
-
except Exception:
|
|
174
|
-
pass
|
|
175
|
-
|
|
176
161
|
# 校验子Agent所用模型是否有效,必要时回退到平台可用模型
|
|
177
162
|
try:
|
|
178
163
|
platform = getattr(agent, "model", None)
|
|
@@ -84,6 +84,7 @@ class SubCodeAgentTool:
|
|
|
84
84
|
parent_agent = None
|
|
85
85
|
except Exception:
|
|
86
86
|
parent_agent = None
|
|
87
|
+
parent_non_interactive = getattr(parent_agent, "non_interactive", None) if parent_agent is not None else None
|
|
87
88
|
model_group = None
|
|
88
89
|
use_tools: List[str] = []
|
|
89
90
|
try:
|
|
@@ -115,7 +116,7 @@ class SubCodeAgentTool:
|
|
|
115
116
|
"search_web",
|
|
116
117
|
"ask_user",
|
|
117
118
|
"read_code",
|
|
118
|
-
|
|
119
|
+
|
|
119
120
|
"save_memory",
|
|
120
121
|
"retrieve_memory",
|
|
121
122
|
"clear_memory",
|
|
@@ -138,6 +139,7 @@ class SubCodeAgentTool:
|
|
|
138
139
|
need_summary=True,
|
|
139
140
|
append_tools=append_tools,
|
|
140
141
|
tool_group=tool_group,
|
|
142
|
+
non_interactive=parent_non_interactive,
|
|
141
143
|
)
|
|
142
144
|
except SystemExit as se:
|
|
143
145
|
# 将底层 sys.exit 转换为工具错误,避免终止进程
|
jarvis/jarvis_utils/config.py
CHANGED
|
@@ -76,17 +76,6 @@ def get_replace_map() -> dict:
|
|
|
76
76
|
return {**BUILTIN_REPLACE_MAP, **file_map}
|
|
77
77
|
|
|
78
78
|
|
|
79
|
-
def get_max_token_count(model_group_override: Optional[str] = None) -> int:
|
|
80
|
-
"""
|
|
81
|
-
获取模型允许的最大token数量。
|
|
82
|
-
|
|
83
|
-
返回:
|
|
84
|
-
int: 模型能处理的最大token数量,为最大输入token数量的30倍。
|
|
85
|
-
"""
|
|
86
|
-
max_input_tokens = get_max_input_token_count(model_group_override)
|
|
87
|
-
return max_input_tokens * 30
|
|
88
|
-
|
|
89
|
-
|
|
90
79
|
def get_max_input_token_count(model_group_override: Optional[str] = None) -> int:
|
|
91
80
|
"""
|
|
92
81
|
获取模型允许的最大输入token数量。
|
|
@@ -712,6 +701,22 @@ def get_tool_filter_threshold() -> int:
|
|
|
712
701
|
return int(GLOBAL_CONFIG_DATA.get("JARVIS_TOOL_FILTER_THRESHOLD", 30))
|
|
713
702
|
|
|
714
703
|
|
|
704
|
+
def get_auto_summary_rounds() -> int:
|
|
705
|
+
"""
|
|
706
|
+
获取基于对话轮次的自动总结阈值。
|
|
707
|
+
|
|
708
|
+
返回:
|
|
709
|
+
int: 轮次阈值,默认20
|
|
710
|
+
"""
|
|
711
|
+
try:
|
|
712
|
+
return int(GLOBAL_CONFIG_DATA.get("JARVIS_AUTO_SUMMARY_ROUNDS", 20))
|
|
713
|
+
except Exception:
|
|
714
|
+
return 20
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
|
|
715
720
|
def get_script_execution_timeout() -> int:
|
|
716
721
|
"""
|
|
717
722
|
获取脚本执行的超时时间(秒)。
|
|
@@ -779,3 +784,13 @@ def is_non_interactive() -> bool:
|
|
|
779
784
|
# 忽略环境变量解析异常,回退到配置
|
|
780
785
|
pass
|
|
781
786
|
return GLOBAL_CONFIG_DATA.get("JARVIS_NON_INTERACTIVE", False) is True
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
def is_skip_predefined_tasks() -> bool:
|
|
790
|
+
"""
|
|
791
|
+
是否跳过预定义任务加载。
|
|
792
|
+
|
|
793
|
+
返回:
|
|
794
|
+
bool: 如果跳过预定义任务加载则返回True,默认为False
|
|
795
|
+
"""
|
|
796
|
+
return GLOBAL_CONFIG_DATA.get("JARVIS_SKIP_PREDEFINED_TASKS", False) is True
|
jarvis/jarvis_utils/input.py
CHANGED
|
@@ -363,11 +363,50 @@ class FileCompleter(Completer):
|
|
|
363
363
|
return tag
|
|
364
364
|
|
|
365
365
|
|
|
366
|
-
|
|
367
|
-
|
|
366
|
+
# ---------------------
|
|
367
|
+
# 公共判定辅助函数(按当前Agent优先)
|
|
368
|
+
# ---------------------
|
|
369
|
+
def _get_current_agent_for_input():
|
|
370
|
+
try:
|
|
371
|
+
import jarvis.jarvis_utils.globals as g
|
|
372
|
+
current_name = getattr(g, "current_agent_name", "")
|
|
373
|
+
if current_name:
|
|
374
|
+
return g.get_agent(current_name)
|
|
375
|
+
except Exception:
|
|
376
|
+
pass
|
|
377
|
+
return None
|
|
378
|
+
|
|
379
|
+
def _is_non_interactive_for_current_agent() -> bool:
|
|
368
380
|
try:
|
|
369
381
|
from jarvis.jarvis_utils.config import is_non_interactive
|
|
370
|
-
|
|
382
|
+
ag = _get_current_agent_for_input()
|
|
383
|
+
try:
|
|
384
|
+
return bool(getattr(ag, "non_interactive", False)) if ag else bool(is_non_interactive())
|
|
385
|
+
except Exception:
|
|
386
|
+
return bool(is_non_interactive())
|
|
387
|
+
except Exception:
|
|
388
|
+
return False
|
|
389
|
+
|
|
390
|
+
def _is_auto_complete_for_current_agent() -> bool:
|
|
391
|
+
try:
|
|
392
|
+
from jarvis.jarvis_utils.config import GLOBAL_CONFIG_DATA
|
|
393
|
+
ag = _get_current_agent_for_input()
|
|
394
|
+
if ag is not None and hasattr(ag, "auto_complete"):
|
|
395
|
+
try:
|
|
396
|
+
return bool(getattr(ag, "auto_complete", False))
|
|
397
|
+
except Exception:
|
|
398
|
+
pass
|
|
399
|
+
env_v = os.getenv("JARVIS_AUTO_COMPLETE")
|
|
400
|
+
if env_v is not None:
|
|
401
|
+
return str(env_v).strip().lower() in ("1", "true", "yes", "on")
|
|
402
|
+
return bool(GLOBAL_CONFIG_DATA.get("JARVIS_AUTO_COMPLETE", False))
|
|
403
|
+
except Exception:
|
|
404
|
+
return False
|
|
405
|
+
|
|
406
|
+
def user_confirm(tip: str, default: bool = True) -> bool:
|
|
407
|
+
"""提示用户确认是/否问题(按当前Agent优先判断非交互)"""
|
|
408
|
+
try:
|
|
409
|
+
if _is_non_interactive_for_current_agent():
|
|
371
410
|
return default
|
|
372
411
|
suffix = "[Y/n]" if default else "[y/N]"
|
|
373
412
|
ret = get_single_line_input(f"{tip} {suffix}: ")
|
|
@@ -666,9 +705,41 @@ def get_multiline_input(tip: str, print_on_empty: bool = True) -> str:
|
|
|
666
705
|
preset: Optional[str] = None
|
|
667
706
|
preset_cursor: Optional[int] = None
|
|
668
707
|
while True:
|
|
669
|
-
from jarvis.jarvis_utils.config import is_non_interactive
|
|
670
|
-
|
|
671
|
-
|
|
708
|
+
from jarvis.jarvis_utils.config import is_non_interactive, GLOBAL_CONFIG_DATA
|
|
709
|
+
# 基于“当前Agent”精确判断非交互与自动完成,避免多Agent相互干扰
|
|
710
|
+
if _is_non_interactive_for_current_agent():
|
|
711
|
+
# 在多Agent系统中,无论是否启用自动完成,均提示可用智能体并建议使用 SEND_MESSAGE 转移控制权
|
|
712
|
+
hint = ""
|
|
713
|
+
try:
|
|
714
|
+
ag = _get_current_agent_for_input()
|
|
715
|
+
ohs = getattr(ag, "output_handler", [])
|
|
716
|
+
available_agents: List[str] = []
|
|
717
|
+
for oh in (ohs or []):
|
|
718
|
+
cfgs = getattr(oh, "agents_config", None)
|
|
719
|
+
if isinstance(cfgs, list):
|
|
720
|
+
for c in cfgs:
|
|
721
|
+
try:
|
|
722
|
+
name = c.get("name")
|
|
723
|
+
except Exception:
|
|
724
|
+
name = None
|
|
725
|
+
if isinstance(name, str) and name.strip():
|
|
726
|
+
available_agents.append(name.strip())
|
|
727
|
+
if available_agents:
|
|
728
|
+
# 去重但保留顺序
|
|
729
|
+
seen = set()
|
|
730
|
+
ordered = []
|
|
731
|
+
for n in available_agents:
|
|
732
|
+
if n not in seen:
|
|
733
|
+
seen.add(n)
|
|
734
|
+
ordered.append(n)
|
|
735
|
+
hint = "\n当前可用智能体: " + ", ".join(ordered) + f"\n如需将任务交给其他智能体,请使用 {ot('SEND_MESSAGE')} 块。"
|
|
736
|
+
except Exception:
|
|
737
|
+
hint = ""
|
|
738
|
+
if _is_auto_complete_for_current_agent():
|
|
739
|
+
base_msg = "我无法与你交互,所有的事情你都自我决策,如果无法决策,就完成任务。输出" + ot("!!!COMPLETE!!!")
|
|
740
|
+
return base_msg + hint
|
|
741
|
+
else:
|
|
742
|
+
return "我无法与你交互,所有的事情你都自我决策" + hint
|
|
672
743
|
user_input = _get_multiline_input_internal(
|
|
673
744
|
tip, preset=preset, preset_cursor=preset_cursor
|
|
674
745
|
)
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
jarvis/__init__.py,sha256=
|
|
2
|
-
jarvis/jarvis_agent/__init__.py,sha256=
|
|
3
|
-
jarvis/jarvis_agent/agent_manager.py,sha256=
|
|
1
|
+
jarvis/__init__.py,sha256=NIbT8I8sAw3cCWWXtArSe6_eWeB17Gf7WmiF9nyxdKs,73
|
|
2
|
+
jarvis/jarvis_agent/__init__.py,sha256=OOoHubIIQ3A9xB7jHFRpJKDtAk0or8Y7TmUkdq00l4Q,51386
|
|
3
|
+
jarvis/jarvis_agent/agent_manager.py,sha256=Q0S-mYTPt8Xd7RKGoLWoWU_RP_wEXFWxCjve8_t2f2A,3807
|
|
4
4
|
jarvis/jarvis_agent/builtin_input_handler.py,sha256=wS-FqpT3pIXwHn1dfL3SpXonUKWgVThbQueUIeyRc2U,2917
|
|
5
|
-
jarvis/jarvis_agent/config.py,sha256=7rSYmgx9hI-PnWA2PLjubOxAbH7_NEDmnDvy6iAnPbQ,3362
|
|
6
5
|
jarvis/jarvis_agent/config_editor.py,sha256=hlb9EYxKWcR_qdW2O89CgNDdciR9Isi743JU_1gD8j4,1927
|
|
7
|
-
jarvis/jarvis_agent/edit_file_handler.py,sha256=
|
|
6
|
+
jarvis/jarvis_agent/edit_file_handler.py,sha256=8j7SRSWTw468fTuR-ueNKFK_0pR1GwDxTvsGGmm3zlA,24714
|
|
8
7
|
jarvis/jarvis_agent/event_bus.py,sha256=pRdfk7d0OG18K6yNfWlCvAh_dW5p9sBtT2Yc3jGmzgo,1519
|
|
9
8
|
jarvis/jarvis_agent/events.py,sha256=rmFQ37PasImCh7OCdCzNBvubk-kHwcUiYLgzmL0t0_4,3689
|
|
10
9
|
jarvis/jarvis_agent/file_context_handler.py,sha256=2MPn_O_2llX39meFg272Cjk3wMPn5nmgbGMUyX06YQo,2113
|
|
11
10
|
jarvis/jarvis_agent/file_methodology_manager.py,sha256=LnhgTx5xQXCBK8esjCkFbgFm9iEyFX7TryUlC40Kzpw,4428
|
|
12
|
-
jarvis/jarvis_agent/jarvis.py,sha256=
|
|
11
|
+
jarvis/jarvis_agent/jarvis.py,sha256=4HlG4Wfs0HRqLq3mLHx3kt5MV--yjLpAkK7KtIhskwQ,48591
|
|
13
12
|
jarvis/jarvis_agent/main.py,sha256=IgS7d3rng2vFlu983OUeCkOAosKjFAn1sFCk3gT9J9Q,4563
|
|
14
13
|
jarvis/jarvis_agent/memory_manager.py,sha256=WSyUffx9xTmkcj4QrSLEfsjI3sTMUwZmkkC9_N_gTjo,8042
|
|
15
14
|
jarvis/jarvis_agent/methodology_share_manager.py,sha256=AB_J9BwRgaeENQfL6bH83FOLeLrgHhppMb7psJNevKs,6874
|
|
@@ -18,7 +17,8 @@ jarvis/jarvis_agent/prompt_builder.py,sha256=PH1fPDVa8z_RXkoXHJFNDf8PQjUoLNLYwkh
|
|
|
18
17
|
jarvis/jarvis_agent/prompt_manager.py,sha256=_1qLBSA3yn4nT_N3X2npTpW40Cp-pMeyvnzu-pnG0iU,2720
|
|
19
18
|
jarvis/jarvis_agent/prompts.py,sha256=CvbPYx_klEz6OQrxVReZAnC2uQNo53rWkkucmh30uKg,9531
|
|
20
19
|
jarvis/jarvis_agent/protocols.py,sha256=YFJaC9MHi7JfLzmvlyotJDjiCO4Z07XJXy1gKhVdUy4,956
|
|
21
|
-
jarvis/jarvis_agent/
|
|
20
|
+
jarvis/jarvis_agent/rewrite_file_handler.py,sha256=FVSrfrC115_cGvdPW9RIn3A-gQAhok7GyyBfnOFdpXs,5276
|
|
21
|
+
jarvis/jarvis_agent/run_loop.py,sha256=iGfa28J2K6I07k6p66O3WJFSk9z4uOarqe6CLqALIsk,6167
|
|
22
22
|
jarvis/jarvis_agent/session_manager.py,sha256=5wVcaZGwJ9cEKTQglSbqyxUDJ2fI5KxYN8C8L16UWLw,3024
|
|
23
23
|
jarvis/jarvis_agent/share_manager.py,sha256=MF2RlomcgPxF8nVUk28DP6IRddZ_tot5l_YRvy0qXSQ,8726
|
|
24
24
|
jarvis/jarvis_agent/shell_input_handler.py,sha256=wiAPjB-9uTkcLszbO5dlOUwIfaeR39RgRcZhahIGqoA,2018
|
|
@@ -28,14 +28,14 @@ jarvis/jarvis_agent/task_manager.py,sha256=lme_aN8vaF_a4Tvv2kaSEnWATy8RPSjogTxeL
|
|
|
28
28
|
jarvis/jarvis_agent/tool_executor.py,sha256=k73cKhZEZpljvui4ZxALlFEIE-iLzJ32Softsmiwzqk,1896
|
|
29
29
|
jarvis/jarvis_agent/tool_share_manager.py,sha256=Do08FRxis0ynwR2a6iRoa6Yq0qCP8NkuhMbPrimaxMA,5169
|
|
30
30
|
jarvis/jarvis_agent/user_interaction.py,sha256=tifFN49GkO_Q80sqOTVmhxwbNWTazF3K0cr8AnnvzdU,1453
|
|
31
|
-
jarvis/jarvis_agent/utils.py,sha256=
|
|
31
|
+
jarvis/jarvis_agent/utils.py,sha256=WJmKys_ceDALL73GdMCOgmjGHBzeRSPj7rmc8Pkrvzc,1784
|
|
32
32
|
jarvis/jarvis_agent/web_bridge.py,sha256=h15PXuPWWfZynWt8bPW4BDeCpIVoIOlRXfO0je6HDx4,6673
|
|
33
33
|
jarvis/jarvis_agent/web_output_sink.py,sha256=sZ6WbLZnuCdT5dS9d8msHY_g-pnj-dvML-I6uJ7-sbc,1733
|
|
34
|
-
jarvis/jarvis_agent/web_server.py,sha256=
|
|
34
|
+
jarvis/jarvis_agent/web_server.py,sha256=oZZy4nAOPhRWJn7K8VjBlho1F9AsvLEYiusKgipjO94,28204
|
|
35
35
|
jarvis/jarvis_code_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
|
-
jarvis/jarvis_code_agent/code_agent.py,sha256=
|
|
36
|
+
jarvis/jarvis_code_agent/code_agent.py,sha256=UaYppteSUzwni-ZUDAKDrGTDijBrXU1Ia91OoLdfYLs,38072
|
|
37
37
|
jarvis/jarvis_code_agent/lint.py,sha256=_qLJB_bC3PuoHG-j4EGOnYzNGO26jHlKLbkysfyQW1c,3954
|
|
38
|
-
jarvis/jarvis_code_analysis/code_review.py,sha256=
|
|
38
|
+
jarvis/jarvis_code_analysis/code_review.py,sha256=A3LaxFAlIH5qCfMajIr02ExG6YiolIVpjl9blsLh4SY,34402
|
|
39
39
|
jarvis/jarvis_code_analysis/checklists/__init__.py,sha256=LIXAYa1sW3l7foP6kohLWnE98I_EQ0T7z5bYKHq6rJA,78
|
|
40
40
|
jarvis/jarvis_code_analysis/checklists/c_cpp.py,sha256=9t62bMqs6qTkFSio4SKkj88qyb5ZubWrw3MxJBQ4X1A,1317
|
|
41
41
|
jarvis/jarvis_code_analysis/checklists/csharp.py,sha256=ShPXrl2_UPAnGaCHAG2wLl90COG3HK2XCSr1UK2dxN4,2420
|
|
@@ -56,7 +56,7 @@ jarvis/jarvis_code_analysis/checklists/shell.py,sha256=aRFYhQQvTgbYd-uY5pc8UHIUA
|
|
|
56
56
|
jarvis/jarvis_code_analysis/checklists/sql.py,sha256=vR0T6qC7b4dURjJVAd7kSVxyvZEQXPG1Jqc2sNTGp5c,2355
|
|
57
57
|
jarvis/jarvis_code_analysis/checklists/swift.py,sha256=TPx4I6Gupvs6tSerRKmTSKEPQpOLEbH2Y7LXg1uBgxc,2566
|
|
58
58
|
jarvis/jarvis_code_analysis/checklists/web.py,sha256=25gGD7pDadZQybNFvALYxWvK0VRjGQb1NVJQElwjyk0,3943
|
|
59
|
-
jarvis/jarvis_data/config_schema.json,sha256=
|
|
59
|
+
jarvis/jarvis_data/config_schema.json,sha256=VlPqakEXx7k2wm5Uv-ZlbKeIPbHNc98r1pHFtXEBBBY,14884
|
|
60
60
|
jarvis/jarvis_data/tiktoken/9b5ad71b2ce5302211f9c61530b329a4922fc6a4,sha256=Ijkht27pm96ZW3_3OFE-7xAPtR0YyTWXoRO8_-hlsqc,1681126
|
|
61
61
|
jarvis/jarvis_git_squash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
62
62
|
jarvis/jarvis_git_squash/main.py,sha256=BRbsEQVXwseVFKliVqV8_JPh1om6QT6dLTHw0jQ7OE0,2474
|
|
@@ -68,11 +68,11 @@ jarvis/jarvis_mcp/streamable_mcp_client.py,sha256=BenOeZGNHdUOJT5Z3cc5MhS6aOeKQg
|
|
|
68
68
|
jarvis/jarvis_memory_organizer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
69
69
|
jarvis/jarvis_memory_organizer/memory_organizer.py,sha256=CMFL46vvtpcTI6oS3CAlYteR6xAlwCkvVJmMT22uDRw,26295
|
|
70
70
|
jarvis/jarvis_methodology/main.py,sha256=uiNzk5b5O6xdvRhsOuD7ubxdd2tPcDsFFnvmes8uH8I,11370
|
|
71
|
-
jarvis/jarvis_multi_agent/__init__.py,sha256=
|
|
72
|
-
jarvis/jarvis_multi_agent/main.py,sha256=
|
|
71
|
+
jarvis/jarvis_multi_agent/__init__.py,sha256=frH5ufVMasKFz_jbVsBk2wH5nq4D0sfDcmfBWQ-DLoA,16726
|
|
72
|
+
jarvis/jarvis_multi_agent/main.py,sha256=vqLzHesgQkpScVvbgOSyi6X7XoEDQYq3dJ9gZfGiPZw,3351
|
|
73
73
|
jarvis/jarvis_platform/__init__.py,sha256=WLQHSiE87PPket2M50_hHzjdMIgPIBx2VF8JfB_NNRk,105
|
|
74
74
|
jarvis/jarvis_platform/ai8.py,sha256=g8JkqPGs9SEbqstNMCc5rCHO0QcPHX9LNvb7HMWwB-Q,11471
|
|
75
|
-
jarvis/jarvis_platform/base.py,sha256=
|
|
75
|
+
jarvis/jarvis_platform/base.py,sha256=ngaQXMMHYYALrrq1Llk7WryjGR67tEtZzOTr6TQfp-k,16620
|
|
76
76
|
jarvis/jarvis_platform/human.py,sha256=jWjW8prEag79e6ddqTPV4nz_Gz6zFBfO4a1EbvP8QWA,4908
|
|
77
77
|
jarvis/jarvis_platform/kimi.py,sha256=KLsf9udAsPRMbQ2JkBeiAlXkupCBwdtMaJ-hpH4Jdkc,15711
|
|
78
78
|
jarvis/jarvis_platform/openai.py,sha256=4YapmkmJmPGfrjktORcIejlB98b83Wsi_48zjBymHAc,9500
|
|
@@ -102,41 +102,39 @@ jarvis/jarvis_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
|
102
102
|
jarvis/jarvis_tools/ask_user.py,sha256=M6DdLNryCE8y1JcdZHEifUgZkPUEPNKc-zDW5p0Mb1k,2029
|
|
103
103
|
jarvis/jarvis_tools/base.py,sha256=tFZkRlbV_a-pbjM-ci9AYmXVJm__FXuzVWKbQEyz4Ao,1639
|
|
104
104
|
jarvis/jarvis_tools/clear_memory.py,sha256=8DOq6dHLemfKTJqu227PWBIp8Iu5K7EXwINzL8DYk8M,8205
|
|
105
|
-
jarvis/jarvis_tools/edit_file.py,sha256=UcJNTVCDEmRaQsN_7_Ip2LjrTDm4wWzj2deuZHiBvLI,9026
|
|
106
105
|
jarvis/jarvis_tools/execute_script.py,sha256=kjl-c6OmQPEeGqEjbuEGoGhb2nAiQoYzz2_2_Y3tIlY,8277
|
|
107
106
|
jarvis/jarvis_tools/file_analyzer.py,sha256=jzVb8fAJn3dWwpCiYH-Wuxva4kpHqBB2_V3x3mzY0Gs,4158
|
|
108
107
|
jarvis/jarvis_tools/generate_new_tool.py,sha256=tJz0YtfDwyH9y00VEWw3Btqr9JCNhvtI8BN9i5hYk_M,8560
|
|
109
108
|
jarvis/jarvis_tools/methodology.py,sha256=_K4GIDUodGEma3SvNRo7Qs5rliijgNespVLyAPN35JU,5233
|
|
110
109
|
jarvis/jarvis_tools/read_code.py,sha256=F1RuO0c69t0h7CvrUGqrTyNcOCcUrFQPACc61O_YSso,6382
|
|
111
110
|
jarvis/jarvis_tools/read_webpage.py,sha256=dfyXJ9vaX-ZRbua1P5ZlaU_SlSzKkeNw-1kI_3-gxFE,5433
|
|
112
|
-
jarvis/jarvis_tools/registry.py,sha256=
|
|
111
|
+
jarvis/jarvis_tools/registry.py,sha256=9gIhiyh7jAAnLeGBIDyUUHwOeDtgOx3UUWk6kRN1sJg,33670
|
|
113
112
|
jarvis/jarvis_tools/retrieve_memory.py,sha256=hhhGSr7jebPHICY9oEKICyI8mfqsRtKjh58qZNZApKc,8624
|
|
114
|
-
jarvis/jarvis_tools/rewrite_file.py,sha256=CuvjWPTbUaPbex9FKSmw_Ru4r6R-CX_3vqTqCTp8nHA,6959
|
|
115
113
|
jarvis/jarvis_tools/save_memory.py,sha256=RQtNxcpU53FFv_EBjH0i0oyQ7jWubm-trD1BHuqaGjI,6985
|
|
116
114
|
jarvis/jarvis_tools/search_web.py,sha256=Hi8WBxcRH02qjOF1qcJP2qSqs3kVOKGFAARfh548Ii4,6370
|
|
117
|
-
jarvis/jarvis_tools/sub_agent.py,sha256=
|
|
118
|
-
jarvis/jarvis_tools/sub_code_agent.py,sha256=
|
|
115
|
+
jarvis/jarvis_tools/sub_agent.py,sha256=Fn2RZ7jLD4cZCWt0HnpSLkdIbeqeZq-1h97Nfg2RAqE,8485
|
|
116
|
+
jarvis/jarvis_tools/sub_code_agent.py,sha256=KpwTCU89kq_RGNpfyA1C0bTl-f0dTvsCyDKplU-hrds,9600
|
|
119
117
|
jarvis/jarvis_tools/virtual_tty.py,sha256=L7-J00ARQvIa25T45Hhqg2eCBl6W2LFgqDlWMWf-7dk,25275
|
|
120
118
|
jarvis/jarvis_tools/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
121
119
|
jarvis/jarvis_tools/cli/main.py,sha256=WL2GNV7WqYl7G1-btRGvCkzDCMk4fPfNvzCrnUFVPxs,9323
|
|
122
120
|
jarvis/jarvis_utils/__init__.py,sha256=67h0ldisGlh3oK4DAeNEL2Bl_VsI3tSmfclasyVlueM,850
|
|
123
121
|
jarvis/jarvis_utils/builtin_replace_map.py,sha256=z8iAqsbZUiGFaozxG1xSu128op8udqHOeEw-GxNt4bU,1708
|
|
124
122
|
jarvis/jarvis_utils/clipboard.py,sha256=D3wzQeqg_yiH7Axs4d6MRxyNa9XxdnenH-ND2uj2WVQ,2967
|
|
125
|
-
jarvis/jarvis_utils/config.py,sha256=
|
|
123
|
+
jarvis/jarvis_utils/config.py,sha256=jOVCrlD597U6FTu8j-lyO93Mpoyqv3Do7Seja_XrRfE,22580
|
|
126
124
|
jarvis/jarvis_utils/embedding.py,sha256=x6mrkL7Bc3qgfuBDsjc4fg4nKG8ofGxVLVVydbsb8PY,2838
|
|
127
125
|
jarvis/jarvis_utils/file_processors.py,sha256=XiM248SHS7lLgQDCbORVFWqinbVDUawYxWDOsLXDxP8,3043
|
|
128
126
|
jarvis/jarvis_utils/fzf.py,sha256=vCs0Uh5dUqGbWzXn2JCtLLCOYE2B39ZNdNveR9PK4DA,1681
|
|
129
127
|
jarvis/jarvis_utils/git_utils.py,sha256=zxjdxbFb_X6aYo-w1fbMx3d2n1ScbmmaAYlE3wGaaSg,24071
|
|
130
128
|
jarvis/jarvis_utils/globals.py,sha256=7Xvf9HY6jYJL4vSD1F1WCoxHkHCAyltJUYt4V9gGVU4,8865
|
|
131
129
|
jarvis/jarvis_utils/http.py,sha256=eRhV3-GYuWmQ0ogq9di9WMlQkFcVb1zGCrySnOgT1x0,4392
|
|
132
|
-
jarvis/jarvis_utils/input.py,sha256=
|
|
130
|
+
jarvis/jarvis_utils/input.py,sha256=4VXpUZoAocW1mldlZd4bmXI8a_CmcQj7IPLBNgNLGSI,40045
|
|
133
131
|
jarvis/jarvis_utils/methodology.py,sha256=z_renvRGgHiC-XTQPuN6rvrJ_ffHlwxK_b1BU_jmNAQ,12800
|
|
134
132
|
jarvis/jarvis_utils/output.py,sha256=y2fVcao_2ZowFl0IxUrJZCi8T6ZM0z-iPzpk8T8eLxc,13623
|
|
135
133
|
jarvis/jarvis_utils/tag.py,sha256=f211opbbbTcSyzCDwuIK_oCnKhXPNK-RknYyGzY1yD0,431
|
|
136
134
|
jarvis/jarvis_utils/utils.py,sha256=uMtfaStxDtp2i9AFIxwtPKgSxLwQxw8Z2rXsX-ZGlis,72728
|
|
137
|
-
jarvis_ai_assistant-0.4.
|
|
138
|
-
jarvis_ai_assistant-0.4.
|
|
139
|
-
jarvis_ai_assistant-0.4.
|
|
140
|
-
jarvis_ai_assistant-0.4.
|
|
141
|
-
jarvis_ai_assistant-0.4.
|
|
142
|
-
jarvis_ai_assistant-0.4.
|
|
135
|
+
jarvis_ai_assistant-0.4.2.dist-info/licenses/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
|
|
136
|
+
jarvis_ai_assistant-0.4.2.dist-info/METADATA,sha256=etNq0w20riwTP8aha2pt_wXBdC6SZHhrjTVeV5K4K38,18751
|
|
137
|
+
jarvis_ai_assistant-0.4.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
138
|
+
jarvis_ai_assistant-0.4.2.dist-info/entry_points.txt,sha256=4GcWKFxRJD-QU14gw_3ZaW4KuEVxOcZK9i270rwPdjA,1395
|
|
139
|
+
jarvis_ai_assistant-0.4.2.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
|
|
140
|
+
jarvis_ai_assistant-0.4.2.dist-info/RECORD,,
|
jarvis/jarvis_agent/config.py
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""
|
|
3
|
-
AgentConfig: 聚合 Agent 的初始化配置并提供默认值解析。
|
|
4
|
-
|
|
5
|
-
目标(阶段一,最小变更):
|
|
6
|
-
- 提供独立的配置承载类,封装 __init__ 中的配置项
|
|
7
|
-
- 支持从全局配置与上下文推导默认值
|
|
8
|
-
- 暂不强制替换 Agent 的现有参数与流程,后续逐步接入
|
|
9
|
-
"""
|
|
10
|
-
from dataclasses import dataclass, field
|
|
11
|
-
from typing import List, Optional
|
|
12
|
-
|
|
13
|
-
from jarvis.jarvis_agent.prompts import DEFAULT_SUMMARY_PROMPT
|
|
14
|
-
from jarvis.jarvis_utils.config import (
|
|
15
|
-
get_max_token_count,
|
|
16
|
-
is_execute_tool_confirm,
|
|
17
|
-
is_force_save_memory,
|
|
18
|
-
is_use_analysis,
|
|
19
|
-
is_use_methodology,
|
|
20
|
-
is_non_interactive,
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@dataclass
|
|
25
|
-
class AgentConfig:
|
|
26
|
-
# 核心身份与系统参数
|
|
27
|
-
system_prompt: str
|
|
28
|
-
name: str = "Jarvis"
|
|
29
|
-
description: str = ""
|
|
30
|
-
model_group: Optional[str] = None
|
|
31
|
-
|
|
32
|
-
# 运行行为
|
|
33
|
-
auto_complete: bool = False
|
|
34
|
-
non_interactive: bool = False
|
|
35
|
-
need_summary: bool = True
|
|
36
|
-
|
|
37
|
-
# 可选配置(None 表示使用默认策略解析)
|
|
38
|
-
summary_prompt: Optional[str] = None
|
|
39
|
-
execute_tool_confirm: Optional[bool] = None
|
|
40
|
-
use_methodology: Optional[bool] = None
|
|
41
|
-
use_analysis: Optional[bool] = None
|
|
42
|
-
force_save_memory: Optional[bool] = None
|
|
43
|
-
files: Optional[List[str]] = field(default_factory=list)
|
|
44
|
-
max_token_count: Optional[int] = None
|
|
45
|
-
|
|
46
|
-
def resolve_defaults(self) -> "AgentConfig":
|
|
47
|
-
"""
|
|
48
|
-
解析并填充默认值,返回新的 AgentConfig 实例,不修改原对象。
|
|
49
|
-
策略与 Agent._init_config 中的逻辑保持一致,确保兼容。
|
|
50
|
-
"""
|
|
51
|
-
# 复制当前实例的浅拷贝数据
|
|
52
|
-
cfg = AgentConfig(
|
|
53
|
-
system_prompt=self.system_prompt,
|
|
54
|
-
name=self.name,
|
|
55
|
-
description=self.description,
|
|
56
|
-
model_group=self.model_group,
|
|
57
|
-
auto_complete=self.auto_complete,
|
|
58
|
-
non_interactive=self.non_interactive,
|
|
59
|
-
need_summary=self.need_summary,
|
|
60
|
-
summary_prompt=self.summary_prompt,
|
|
61
|
-
execute_tool_confirm=self.execute_tool_confirm,
|
|
62
|
-
use_methodology=self.use_methodology,
|
|
63
|
-
use_analysis=self.use_analysis,
|
|
64
|
-
force_save_memory=self.force_save_memory,
|
|
65
|
-
files=list(self.files or []),
|
|
66
|
-
max_token_count=self.max_token_count,
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
# use_methodology: 若存在上传文件则禁用;否则按照外部传入或全局默认
|
|
70
|
-
if cfg.files:
|
|
71
|
-
cfg.use_methodology = False
|
|
72
|
-
elif cfg.use_methodology is None:
|
|
73
|
-
cfg.use_methodology = is_use_methodology()
|
|
74
|
-
|
|
75
|
-
# use_analysis
|
|
76
|
-
if cfg.use_analysis is None:
|
|
77
|
-
cfg.use_analysis = is_use_analysis()
|
|
78
|
-
|
|
79
|
-
# execute_tool_confirm
|
|
80
|
-
if cfg.execute_tool_confirm is None:
|
|
81
|
-
cfg.execute_tool_confirm = is_execute_tool_confirm()
|
|
82
|
-
|
|
83
|
-
# summary_prompt
|
|
84
|
-
if cfg.summary_prompt is None:
|
|
85
|
-
cfg.summary_prompt = DEFAULT_SUMMARY_PROMPT
|
|
86
|
-
|
|
87
|
-
# max_token_count
|
|
88
|
-
if cfg.max_token_count is None:
|
|
89
|
-
cfg.max_token_count = get_max_token_count(cfg.model_group)
|
|
90
|
-
|
|
91
|
-
# force_save_memory
|
|
92
|
-
if cfg.force_save_memory is None:
|
|
93
|
-
cfg.force_save_memory = is_force_save_memory()
|
|
94
|
-
|
|
95
|
-
# 非交互模式下默认开启自动完成
|
|
96
|
-
if is_non_interactive():
|
|
97
|
-
cfg.auto_complete = True
|
|
98
|
-
|
|
99
|
-
return cfg
|