jarvis-ai-assistant 0.1.179__py3-none-any.whl → 0.1.181__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.
Potentially problematic release.
This version of jarvis-ai-assistant might be problematic. Click here for more details.
- jarvis/__init__.py +1 -1
- jarvis/jarvis_code_agent/code_agent.py +34 -106
- jarvis/jarvis_data/config_schema.json +230 -0
- jarvis/jarvis_dev/main.py +66 -112
- jarvis/jarvis_git_utils/git_commiter.py +1 -1
- jarvis/jarvis_platform/base.py +4 -2
- jarvis/jarvis_platform/kimi.py +0 -22
- jarvis/jarvis_platform/openai.py +0 -15
- jarvis/jarvis_platform/yuanbao.py +0 -24
- jarvis/jarvis_smart_shell/main.py +6 -3
- jarvis/jarvis_tools/code_plan.py +1 -3
- jarvis/jarvis_tools/edit_file.py +1 -1
- jarvis/jarvis_tools/execute_script.py +31 -8
- jarvis/jarvis_tools/registry.py +41 -35
- jarvis/jarvis_utils/builtin_replace_map.py +0 -48
- jarvis/jarvis_utils/config.py +61 -20
- jarvis/jarvis_utils/git_utils.py +89 -16
- jarvis/jarvis_utils/utils.py +131 -62
- {jarvis_ai_assistant-0.1.179.dist-info → jarvis_ai_assistant-0.1.181.dist-info}/METADATA +45 -51
- {jarvis_ai_assistant-0.1.179.dist-info → jarvis_ai_assistant-0.1.181.dist-info}/RECORD +24 -25
- {jarvis_ai_assistant-0.1.179.dist-info → jarvis_ai_assistant-0.1.181.dist-info}/entry_points.txt +0 -2
- jarvis/jarvis_tools/ask_codebase.py +0 -294
- jarvis/jarvis_tools/find_methodology.py +0 -73
- {jarvis_ai_assistant-0.1.179.dist-info → jarvis_ai_assistant-0.1.181.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.1.179.dist-info → jarvis_ai_assistant-0.1.181.dist-info}/licenses/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.179.dist-info → jarvis_ai_assistant-0.1.181.dist-info}/top_level.txt +0 -0
jarvis/jarvis_dev/main.py
CHANGED
|
@@ -38,9 +38,8 @@ PM_PROMPT = f"""
|
|
|
38
38
|
<step>
|
|
39
39
|
### 1. 需求接收与分析
|
|
40
40
|
1. 接收用户需求,使用ask_user工具澄清不明确点
|
|
41
|
-
2. 使用
|
|
42
|
-
3. 使用
|
|
43
|
-
4. 使用file_operation记录需求文档
|
|
41
|
+
2. 使用search_web研究相关领域知识
|
|
42
|
+
3. 使用file_operation记录需求文档
|
|
44
43
|
</step>
|
|
45
44
|
|
|
46
45
|
<step>
|
|
@@ -118,7 +117,6 @@ PM_PROMPT = f"""
|
|
|
118
117
|
- **search_web**:研究相关领域知识,寻找最佳实践
|
|
119
118
|
- **execute_script**:监控项目状态,执行自动化任务
|
|
120
119
|
- **methodology**:采用适当的项目方法论和最佳实践
|
|
121
|
-
- **ask_codebase**:分析代码库,了解系统实现和技术债务
|
|
122
120
|
</tools>
|
|
123
121
|
|
|
124
122
|
<message_template>
|
|
@@ -205,9 +203,8 @@ BA_PROMPT = f"""
|
|
|
205
203
|
### 1. 需求接收与分析
|
|
206
204
|
1. 接收PM的需求任务
|
|
207
205
|
2. 使用ask_user工具澄清不明确点
|
|
208
|
-
3. 使用
|
|
209
|
-
4. 使用
|
|
210
|
-
5. 使用file_operation记录需求文档
|
|
206
|
+
3. 使用search_web研究相关领域知识
|
|
207
|
+
4. 使用file_operation记录需求文档
|
|
211
208
|
</step>
|
|
212
209
|
|
|
213
210
|
<step>
|
|
@@ -252,7 +249,6 @@ BA_PROMPT = f"""
|
|
|
252
249
|
- **ask_user**:获取用户需求和反馈,澄清不明确的需求点
|
|
253
250
|
- **file_operation**:创建和管理需求文档,跟踪需求状态
|
|
254
251
|
- **search_web**:研究相关领域知识,寻找最佳实践
|
|
255
|
-
- **ask_codebase**:分析代码库,了解系统实现和业务逻辑
|
|
256
252
|
</tools>
|
|
257
253
|
|
|
258
254
|
<message_template>
|
|
@@ -340,64 +336,57 @@ SA_PROMPT = f"""
|
|
|
340
336
|
<step>
|
|
341
337
|
### 1. 需求分析与理解
|
|
342
338
|
1. 接收PM分配的架构设计任务
|
|
343
|
-
2. 使用
|
|
344
|
-
3. 使用
|
|
345
|
-
4. 使用
|
|
346
|
-
5. 使用file_operation记录需求理解
|
|
339
|
+
2. 使用read_code深入理解关键代码
|
|
340
|
+
3. 使用search_web研究技术趋势
|
|
341
|
+
4. 使用file_operation记录需求理解
|
|
347
342
|
</step>
|
|
348
343
|
|
|
349
344
|
<step>
|
|
350
345
|
### 2. 架构设计规划
|
|
351
346
|
1. 使用methodology选择架构设计方法
|
|
352
|
-
2. 使用
|
|
353
|
-
3. 使用
|
|
354
|
-
4. 使用
|
|
355
|
-
5. 使用file_operation记录设计规划
|
|
347
|
+
2. 使用execute_script检查系统环境
|
|
348
|
+
3. 使用search_web研究架构模式
|
|
349
|
+
4. 使用file_operation记录设计规划
|
|
356
350
|
</step>
|
|
357
351
|
|
|
358
352
|
<step>
|
|
359
353
|
### 3. 系统架构设计
|
|
360
354
|
1. 设计系统整体架构
|
|
361
355
|
2. 使用file_operation记录架构文档
|
|
362
|
-
3. 使用
|
|
363
|
-
4. 使用
|
|
364
|
-
5. 使用file_operation更新架构设计
|
|
356
|
+
3. 使用search_web研究技术选型
|
|
357
|
+
4. 使用file_operation更新架构设计
|
|
365
358
|
</step>
|
|
366
359
|
|
|
367
360
|
<step>
|
|
368
361
|
### 4. 组件设计
|
|
369
362
|
1. 设计系统组件和模块
|
|
370
363
|
2. 使用file_operation记录组件规格
|
|
371
|
-
3. 使用
|
|
372
|
-
4. 使用
|
|
373
|
-
5. 使用file_operation更新组件设计
|
|
364
|
+
3. 使用execute_script验证组件接口
|
|
365
|
+
4. 使用file_operation更新组件设计
|
|
374
366
|
</step>
|
|
375
367
|
|
|
376
368
|
<step>
|
|
377
369
|
### 5. 接口设计
|
|
378
370
|
1. 设计系统接口和API
|
|
379
371
|
2. 使用file_operation记录接口文档
|
|
380
|
-
3. 使用
|
|
381
|
-
4. 使用
|
|
382
|
-
5. 使用file_operation更新接口设计
|
|
372
|
+
3. 使用search_web研究接口规范
|
|
373
|
+
4. 使用file_operation更新接口设计
|
|
383
374
|
</step>
|
|
384
375
|
|
|
385
376
|
<step>
|
|
386
377
|
### 6. 数据模型设计
|
|
387
378
|
1. 设计系统数据模型
|
|
388
379
|
2. 使用file_operation记录数据模型
|
|
389
|
-
3. 使用
|
|
390
|
-
4. 使用
|
|
391
|
-
5. 使用file_operation更新数据模型
|
|
380
|
+
3. 使用execute_script验证数据约束
|
|
381
|
+
4. 使用file_operation更新数据模型
|
|
392
382
|
</step>
|
|
393
383
|
|
|
394
384
|
<step>
|
|
395
385
|
### 7. 架构验证与交付
|
|
396
|
-
1. 使用
|
|
397
|
-
2. 使用
|
|
398
|
-
3.
|
|
399
|
-
4.
|
|
400
|
-
5. 使用file_operation归档架构文档
|
|
386
|
+
1. 使用file_operation整理架构文档
|
|
387
|
+
2. 使用execute_script生成架构报告
|
|
388
|
+
3. 向PM提交架构设计结果
|
|
389
|
+
4. 使用file_operation归档架构文档
|
|
401
390
|
</step>
|
|
402
391
|
</workflow>
|
|
403
392
|
|
|
@@ -405,7 +394,6 @@ SA_PROMPT = f"""
|
|
|
405
394
|
## 工具使用指南
|
|
406
395
|
- **file_operation**:创建和管理架构文档和技术规格
|
|
407
396
|
- **search_web**:研究架构模式和技术趋势
|
|
408
|
-
- **ask_codebase**:分析代码库,理解系统实现
|
|
409
397
|
- **execute_script**:检查系统环境和依赖关系
|
|
410
398
|
- **read_code**:阅读和理解关键代码段
|
|
411
399
|
- **methodology**:应用架构设计方法论和模式
|
|
@@ -497,46 +485,40 @@ TL_PROMPT = f"""
|
|
|
497
485
|
<step>
|
|
498
486
|
### 1. 架构理解与规划
|
|
499
487
|
1. 接收PM分配的技术实施任务
|
|
500
|
-
2. 使用
|
|
501
|
-
3. 使用
|
|
502
|
-
4. 使用
|
|
503
|
-
5. 使用file_operation记录技术规划
|
|
488
|
+
2. 使用lsp_get_diagnostics检查代码问题
|
|
489
|
+
3. 使用execute_script验证技术环境
|
|
490
|
+
4. 使用file_operation记录技术规划
|
|
504
491
|
</step>
|
|
505
492
|
|
|
506
493
|
<step>
|
|
507
494
|
### 2. 技术方案制定
|
|
508
495
|
1. 使用methodology选择开发方法
|
|
509
|
-
2. 使用
|
|
510
|
-
3. 使用
|
|
511
|
-
4. 使用execute_script验证技术方案
|
|
512
|
-
5. 使用file_operation记录技术方案
|
|
496
|
+
2. 使用execute_script验证技术方案
|
|
497
|
+
3. 使用file_operation记录技术方案
|
|
513
498
|
</step>
|
|
514
499
|
|
|
515
500
|
<step>
|
|
516
501
|
### 3. 开发规范制定
|
|
517
502
|
1. 制定代码规范和标准
|
|
518
503
|
2. 使用file_operation记录开发规范
|
|
519
|
-
3. 使用
|
|
520
|
-
4. 使用
|
|
521
|
-
5. 使用file_operation更新开发规范
|
|
504
|
+
3. 使用execute_script验证规范执行
|
|
505
|
+
4. 使用file_operation更新开发规范
|
|
522
506
|
</step>
|
|
523
507
|
|
|
524
508
|
<step>
|
|
525
509
|
### 4. 任务分解与分配
|
|
526
510
|
1. 分解技术任务为可执行单元
|
|
527
511
|
2. 使用file_operation记录任务分解
|
|
528
|
-
3. 使用
|
|
529
|
-
4. 使用
|
|
530
|
-
5. 使用file_operation更新任务分配
|
|
512
|
+
3. 使用execute_script验证任务划分
|
|
513
|
+
4. 使用file_operation更新任务分配
|
|
531
514
|
</step>
|
|
532
515
|
|
|
533
516
|
<step>
|
|
534
517
|
### 5. 技术指导与支持
|
|
535
518
|
1. 向DEV提供技术指导
|
|
536
519
|
2. 使用file_operation记录指导内容
|
|
537
|
-
3. 使用
|
|
538
|
-
4. 使用
|
|
539
|
-
5. 使用file_operation更新技术文档
|
|
520
|
+
3. 使用lsp_get_diagnostics检查代码质量
|
|
521
|
+
4. 使用file_operation更新技术文档
|
|
540
522
|
</step>
|
|
541
523
|
|
|
542
524
|
<step>
|
|
@@ -550,18 +532,16 @@ TL_PROMPT = f"""
|
|
|
550
532
|
|
|
551
533
|
<step>
|
|
552
534
|
### 7. 技术总结与交付
|
|
553
|
-
1. 使用
|
|
554
|
-
2. 使用
|
|
555
|
-
3.
|
|
556
|
-
4.
|
|
557
|
-
5. 使用file_operation归档技术文档
|
|
535
|
+
1. 使用file_operation整理技术文档
|
|
536
|
+
2. 使用execute_script生成技术报告
|
|
537
|
+
3. 向PM提交技术实施结果
|
|
538
|
+
4. 使用file_operation归档技术文档
|
|
558
539
|
</step>
|
|
559
540
|
</workflow>
|
|
560
541
|
|
|
561
542
|
<tools>
|
|
562
543
|
## 工具使用指南
|
|
563
544
|
- **file_operation**:管理技术文档和指导文件
|
|
564
|
-
- **ask_codebase**:分析代码库,理解实现细节
|
|
565
545
|
- **execute_script**:执行开发工具和命令
|
|
566
546
|
- **methodology**:应用开发方法论和最佳实践
|
|
567
547
|
</tools>
|
|
@@ -651,28 +631,25 @@ DEV_PROMPT = f"""
|
|
|
651
631
|
<step>
|
|
652
632
|
### 1. 任务理解与分析
|
|
653
633
|
1. 接收TL分配的开发任务
|
|
654
|
-
2. 使用
|
|
655
|
-
3. 使用
|
|
656
|
-
4. 使用
|
|
657
|
-
5. 使用file_operation记录任务分析
|
|
634
|
+
2. 使用read_code理解现有实现
|
|
635
|
+
3. 使用execute_script验证开发环境
|
|
636
|
+
4. 使用file_operation记录任务分析
|
|
658
637
|
</step>
|
|
659
638
|
|
|
660
639
|
<step>
|
|
661
640
|
### 2. 技术方案设计
|
|
662
641
|
1. 分析实现方案
|
|
663
642
|
2. 使用file_operation记录设计方案
|
|
664
|
-
3. 使用
|
|
665
|
-
4. 使用
|
|
666
|
-
5. 使用file_operation更新技术方案
|
|
643
|
+
3. 使用execute_script验证技术选型
|
|
644
|
+
4. 使用file_operation更新技术方案
|
|
667
645
|
</step>
|
|
668
646
|
|
|
669
647
|
<step>
|
|
670
648
|
### 3. 代码实现
|
|
671
649
|
1. 使用create_code_agent生成代码
|
|
672
650
|
2. 使用file_operation记录代码实现
|
|
673
|
-
3. 使用
|
|
674
|
-
4. 使用
|
|
675
|
-
5. 使用file_operation更新代码文档
|
|
651
|
+
3. 使用execute_script验证代码功能
|
|
652
|
+
4. 使用file_operation更新代码文档
|
|
676
653
|
</step>
|
|
677
654
|
|
|
678
655
|
<step>
|
|
@@ -680,17 +657,15 @@ DEV_PROMPT = f"""
|
|
|
680
657
|
1. 编写单元测试代码
|
|
681
658
|
2. 使用file_operation记录测试用例
|
|
682
659
|
3. 使用execute_script运行单元测试
|
|
683
|
-
4. 使用
|
|
684
|
-
5. 使用file_operation更新测试文档
|
|
660
|
+
4. 使用file_operation更新测试文档
|
|
685
661
|
</step>
|
|
686
662
|
|
|
687
663
|
<step>
|
|
688
664
|
### 5. 代码优化与重构
|
|
689
665
|
1. 优化代码实现
|
|
690
666
|
2. 使用file_operation记录优化方案
|
|
691
|
-
3. 使用
|
|
692
|
-
4. 使用
|
|
693
|
-
5. 使用file_operation更新优化文档
|
|
667
|
+
3. 使用execute_script验证优化效果
|
|
668
|
+
4. 使用file_operation更新优化文档
|
|
694
669
|
</step>
|
|
695
670
|
|
|
696
671
|
<step>
|
|
@@ -704,11 +679,10 @@ DEV_PROMPT = f"""
|
|
|
704
679
|
|
|
705
680
|
<step>
|
|
706
681
|
### 7. 代码提交与交付
|
|
707
|
-
1. 使用
|
|
708
|
-
2. 使用
|
|
709
|
-
3.
|
|
710
|
-
4.
|
|
711
|
-
5. 使用file_operation归档开发文档
|
|
682
|
+
1. 使用file_operation整理代码文档
|
|
683
|
+
2. 使用execute_script生成提交报告
|
|
684
|
+
3. 向TL提交代码实现结果
|
|
685
|
+
4. 使用file_operation归档开发文档
|
|
712
686
|
</step>
|
|
713
687
|
</workflow>
|
|
714
688
|
|
|
@@ -716,7 +690,6 @@ DEV_PROMPT = f"""
|
|
|
716
690
|
## 工具使用指南
|
|
717
691
|
- **create_code_agent**:创建专业代码开发代理
|
|
718
692
|
- **file_operation**:管理源代码和配置文件
|
|
719
|
-
- **ask_codebase**:了解代码库实现细节
|
|
720
693
|
- **execute_script**:执行开发命令和测试脚本
|
|
721
694
|
- **read_code**:阅读和理解关键代码段
|
|
722
695
|
- **create_sub_agent**:创建专门的子代理处理特定任务
|
|
@@ -832,37 +805,33 @@ QA_PROMPT = f"""
|
|
|
832
805
|
<step>
|
|
833
806
|
### 1. 测试需求分析
|
|
834
807
|
1. 接收PM分配的测试任务
|
|
835
|
-
2. 使用
|
|
836
|
-
3. 使用
|
|
837
|
-
4. 使用
|
|
838
|
-
5. 使用file_operation记录测试需求
|
|
808
|
+
2. 使用read_code理解功能实现
|
|
809
|
+
3. 使用execute_script验证测试环境
|
|
810
|
+
4. 使用file_operation记录测试需求
|
|
839
811
|
</step>
|
|
840
812
|
|
|
841
813
|
<step>
|
|
842
814
|
### 2. 测试计划制定
|
|
843
815
|
1. 使用methodology选择测试方法
|
|
844
816
|
2. 使用file_operation记录测试计划
|
|
845
|
-
3. 使用
|
|
846
|
-
4. 使用
|
|
847
|
-
5. 使用file_operation更新测试计划
|
|
817
|
+
3. 使用execute_script验证测试工具
|
|
818
|
+
4. 使用file_operation更新测试计划
|
|
848
819
|
</step>
|
|
849
820
|
|
|
850
821
|
<step>
|
|
851
822
|
### 3. 测试用例设计
|
|
852
823
|
1. 设计测试用例
|
|
853
824
|
2. 使用file_operation记录测试用例
|
|
854
|
-
3. 使用
|
|
855
|
-
4. 使用
|
|
856
|
-
5. 使用file_operation更新测试用例
|
|
825
|
+
3. 使用execute_script验证测试用例
|
|
826
|
+
4. 使用file_operation更新测试用例
|
|
857
827
|
</step>
|
|
858
828
|
|
|
859
829
|
<step>
|
|
860
830
|
### 4. 测试环境准备
|
|
861
831
|
1. 配置测试环境
|
|
862
832
|
2. 使用file_operation记录环境配置
|
|
863
|
-
3. 使用
|
|
864
|
-
4. 使用
|
|
865
|
-
5. 使用file_operation更新环境文档
|
|
833
|
+
3. 使用execute_script验证环境配置
|
|
834
|
+
4. 使用file_operation更新环境文档
|
|
866
835
|
</step>
|
|
867
836
|
|
|
868
837
|
<step>
|
|
@@ -878,18 +847,16 @@ QA_PROMPT = f"""
|
|
|
878
847
|
### 6. 缺陷管理
|
|
879
848
|
1. 分析缺陷
|
|
880
849
|
2. 使用file_operation记录缺陷信息
|
|
881
|
-
3. 使用
|
|
882
|
-
4. 使用
|
|
883
|
-
5. 使用file_operation更新缺陷报告
|
|
850
|
+
3. 使用execute_script验证缺陷修复
|
|
851
|
+
4. 使用file_operation更新缺陷报告
|
|
884
852
|
</step>
|
|
885
853
|
|
|
886
854
|
<step>
|
|
887
855
|
### 7. 质量评估与交付
|
|
888
|
-
1. 使用
|
|
889
|
-
2. 使用
|
|
890
|
-
3.
|
|
891
|
-
4.
|
|
892
|
-
5. 使用file_operation归档测试文档
|
|
856
|
+
1. 使用file_operation整理测试文档
|
|
857
|
+
2. 使用execute_script生成质量报告
|
|
858
|
+
3. 向PM提交测试结果
|
|
859
|
+
4. 使用file_operation归档测试文档
|
|
893
860
|
</step>
|
|
894
861
|
</workflow>
|
|
895
862
|
|
|
@@ -897,7 +864,6 @@ QA_PROMPT = f"""
|
|
|
897
864
|
## 工具使用指南
|
|
898
865
|
- **create_code_agent**:创建测试代码开发代理
|
|
899
866
|
- **file_operation**:管理测试文档和测试脚本
|
|
900
|
-
- **ask_codebase**:了解代码库实现以设计测试
|
|
901
867
|
- **execute_script**:执行测试命令和测试套件
|
|
902
868
|
- **read_code**:阅读和理解代码以设计测试用例
|
|
903
869
|
- **methodology**:应用测试方法论和最佳实践
|
|
@@ -994,7 +960,6 @@ def create_dev_team() -> MultiAgent:
|
|
|
994
960
|
"search_web",
|
|
995
961
|
"execute_script",
|
|
996
962
|
"methodology",
|
|
997
|
-
"ask_codebase",
|
|
998
963
|
"edit_file",
|
|
999
964
|
"rewrite_file",
|
|
1000
965
|
])
|
|
@@ -1007,7 +972,6 @@ def create_dev_team() -> MultiAgent:
|
|
|
1007
972
|
"execute_script",
|
|
1008
973
|
"read_webpage",
|
|
1009
974
|
"methodology",
|
|
1010
|
-
"ask_codebase",
|
|
1011
975
|
"edit_file",
|
|
1012
976
|
"rewrite_file",
|
|
1013
977
|
])
|
|
@@ -1016,7 +980,6 @@ def create_dev_team() -> MultiAgent:
|
|
|
1016
980
|
SA_output_handler.use_tools([
|
|
1017
981
|
"file_operation",
|
|
1018
982
|
"search_web",
|
|
1019
|
-
"ask_codebase",
|
|
1020
983
|
"execute_script",
|
|
1021
984
|
"read_code",
|
|
1022
985
|
"methodology",
|
|
@@ -1027,7 +990,6 @@ def create_dev_team() -> MultiAgent:
|
|
|
1027
990
|
TL_output_handler = ToolRegistry()
|
|
1028
991
|
TL_output_handler.use_tools([
|
|
1029
992
|
"file_operation",
|
|
1030
|
-
"ask_codebase",
|
|
1031
993
|
"execute_script",
|
|
1032
994
|
"methodology",
|
|
1033
995
|
"edit_file",
|
|
@@ -1038,7 +1000,6 @@ def create_dev_team() -> MultiAgent:
|
|
|
1038
1000
|
DEV_output_handler.use_tools([
|
|
1039
1001
|
"create_code_agent",
|
|
1040
1002
|
"file_operation",
|
|
1041
|
-
"ask_codebase",
|
|
1042
1003
|
"execute_script",
|
|
1043
1004
|
"read_code",
|
|
1044
1005
|
"create_sub_agent",
|
|
@@ -1051,7 +1012,6 @@ def create_dev_team() -> MultiAgent:
|
|
|
1051
1012
|
QA_output_handler.use_tools([
|
|
1052
1013
|
"create_code_agent",
|
|
1053
1014
|
"file_operation",
|
|
1054
|
-
"ask_codebase",
|
|
1055
1015
|
"execute_script",
|
|
1056
1016
|
"read_code",
|
|
1057
1017
|
"methodology",
|
|
@@ -1067,7 +1027,6 @@ def create_dev_team() -> MultiAgent:
|
|
|
1067
1027
|
- **search_web**:研究相关领域知识,寻找最佳实践
|
|
1068
1028
|
- **execute_script**:监控项目状态,执行自动化任务
|
|
1069
1029
|
- **methodology**:采用适当的项目方法论和最佳实践
|
|
1070
|
-
- **ask_codebase**:分析代码库,了解系统实现和技术债务
|
|
1071
1030
|
|
|
1072
1031
|
## 文档管理规范
|
|
1073
1032
|
每一步工作后,必须使用file_operation工具将结论性输出记录到项目文档中:
|
|
@@ -1089,7 +1048,6 @@ def create_dev_team() -> MultiAgent:
|
|
|
1089
1048
|
- **execute_script**:查询系统环境和配置信息
|
|
1090
1049
|
- **read_webpage**:收集用户体验和行业趋势信息
|
|
1091
1050
|
- **methodology**:应用需求分析和用户故事映射方法论
|
|
1092
|
-
- **ask_codebase**:分析代码库中的功能实现,了解现有系统能力和限制,分析业务逻辑
|
|
1093
1051
|
|
|
1094
1052
|
## 文档管理规范
|
|
1095
1053
|
每一步分析后,必须使用file_operation工具将结论性输出记录到分析文档中:
|
|
@@ -1108,7 +1066,6 @@ def create_dev_team() -> MultiAgent:
|
|
|
1108
1066
|
## 工具使用指南
|
|
1109
1067
|
- **file_operation**:创建和管理架构文档和技术规格
|
|
1110
1068
|
- **search_web**:研究架构模式和技术趋势
|
|
1111
|
-
- **ask_codebase**:分析代码库,理解系统实现
|
|
1112
1069
|
- **execute_script**:检查系统环境和依赖关系
|
|
1113
1070
|
- **read_code**:阅读和理解关键代码段
|
|
1114
1071
|
- **methodology**:应用架构设计方法论和模式
|
|
@@ -1129,7 +1086,6 @@ def create_dev_team() -> MultiAgent:
|
|
|
1129
1086
|
TL_PROMPT_EXTENSION = """
|
|
1130
1087
|
## 工具使用指南
|
|
1131
1088
|
- **file_operation**:管理技术文档和指导文件
|
|
1132
|
-
- **ask_codebase**:分析代码库,理解实现细节
|
|
1133
1089
|
- **execute_script**:执行开发工具和命令
|
|
1134
1090
|
|
|
1135
1091
|
## 文档管理规范
|
|
@@ -1150,7 +1106,6 @@ def create_dev_team() -> MultiAgent:
|
|
|
1150
1106
|
## 工具使用指南
|
|
1151
1107
|
- **create_code_agent**:创建专业代码开发代理
|
|
1152
1108
|
- **file_operation**:管理源代码和配置文件
|
|
1153
|
-
- **ask_codebase**:了解代码库实现细节
|
|
1154
1109
|
- **execute_script**:执行开发命令和测试脚本
|
|
1155
1110
|
- **read_code**:阅读和理解关键代码段
|
|
1156
1111
|
- **create_sub_agent**:创建专门的子代理处理特定任务
|
|
@@ -1173,7 +1128,6 @@ def create_dev_team() -> MultiAgent:
|
|
|
1173
1128
|
## 工具使用指南
|
|
1174
1129
|
- **create_code_agent**:创建测试代码开发代理
|
|
1175
1130
|
- **file_operation**:管理测试文档和测试脚本
|
|
1176
|
-
- **ask_codebase**:了解代码库实现以设计测试
|
|
1177
1131
|
- **execute_script**:执行测试命令和测试套件
|
|
1178
1132
|
- **execute_script**:执行各类脚本(Shell命令、Shell脚本、Python脚本)
|
|
1179
1133
|
- **read_code**:阅读和理解代码以设计测试用例
|
jarvis/jarvis_platform/base.py
CHANGED
|
@@ -126,9 +126,11 @@ class BasePlatform(ABC):
|
|
|
126
126
|
return response
|
|
127
127
|
|
|
128
128
|
def chat_until_success(self, message: str) -> str:
|
|
129
|
-
|
|
129
|
+
"""Chat with model until successful response"""
|
|
130
|
+
if not self.suppress_output and is_print_prompt():
|
|
130
131
|
PrettyOutput.print(f"{message}", OutputType.USER)
|
|
131
|
-
|
|
132
|
+
result: str = while_true(lambda: while_success(lambda: self._chat(message), 5), 5)
|
|
133
|
+
return result
|
|
132
134
|
|
|
133
135
|
@abstractmethod
|
|
134
136
|
def name(self) -> str:
|
jarvis/jarvis_platform/kimi.py
CHANGED
|
@@ -6,10 +6,6 @@ import time
|
|
|
6
6
|
from typing import Dict, Generator, List, Tuple
|
|
7
7
|
|
|
8
8
|
import requests # type: ignore
|
|
9
|
-
from rich import box
|
|
10
|
-
from rich.live import Live
|
|
11
|
-
from rich.panel import Panel
|
|
12
|
-
from rich.text import Text
|
|
13
9
|
|
|
14
10
|
from jarvis.jarvis_platform.base import BasePlatform
|
|
15
11
|
from jarvis.jarvis_utils.config import get_data_dir
|
|
@@ -37,24 +33,6 @@ class KimiModel(BasePlatform):
|
|
|
37
33
|
self.chat_id = ""
|
|
38
34
|
self.api_key = os.getenv("KIMI_API_KEY")
|
|
39
35
|
if not self.api_key:
|
|
40
|
-
message = (
|
|
41
|
-
"需要设置 KIMI_API_KEY 才能使用 Jarvis。请按照以下步骤操作:\n"
|
|
42
|
-
"1. 获取 Kimi API Key:\n"
|
|
43
|
-
" • 访问 Kimi AI 平台: https://kimi.moonshot.cn\n"
|
|
44
|
-
" • 登录您的账户\n"
|
|
45
|
-
" • 打开浏览器开发者工具 (F12 或右键 -> 检查)\n"
|
|
46
|
-
" • 切换到网络标签\n"
|
|
47
|
-
" • 发送任意消息\n"
|
|
48
|
-
" • 在请求中找到 Authorization 头\n"
|
|
49
|
-
" • 复制 token 值(去掉 'Bearer ' 前缀)\n"
|
|
50
|
-
"2. 设置环境变量:\n"
|
|
51
|
-
" • 方法 1: 创建或编辑配置文件:\n"
|
|
52
|
-
f" echo 'KIMI_API_KEY=your_key_here' > {get_data_dir()}/env\n"
|
|
53
|
-
" • 方法 2: 直接设置环境变量:\n"
|
|
54
|
-
" export KIMI_API_KEY=your_key_here\n"
|
|
55
|
-
"设置后,重新运行 Jarvis。"
|
|
56
|
-
)
|
|
57
|
-
PrettyOutput.print(message, OutputType.INFO)
|
|
58
36
|
PrettyOutput.print("KIMI_API_KEY 未设置", OutputType.WARNING)
|
|
59
37
|
self.auth_header = f"Bearer {self.api_key}"
|
|
60
38
|
self.uploaded_files = [] # 存储已上传文件的信息
|
jarvis/jarvis_platform/openai.py
CHANGED
|
@@ -19,21 +19,6 @@ class OpenAIModel(BasePlatform):
|
|
|
19
19
|
self.system_message = ""
|
|
20
20
|
self.api_key = os.getenv("OPENAI_API_KEY")
|
|
21
21
|
if not self.api_key:
|
|
22
|
-
message = (
|
|
23
|
-
"需要设置以下环境变量才能使用 OpenAI 模型:\n"
|
|
24
|
-
" • OPENAI_API_KEY: API 密钥\n"
|
|
25
|
-
" • OPENAI_API_BASE: (可选) API 基础地址, 默认使用 https://api.openai.com/v1\n"
|
|
26
|
-
"您可以通过以下方式设置它们:\n"
|
|
27
|
-
"1. 创建或编辑 ~/.jarvis/env 文件:\n"
|
|
28
|
-
" OPENAI_API_KEY=your_api_key\n"
|
|
29
|
-
" OPENAI_API_BASE=your_api_base\n"
|
|
30
|
-
" OPENAI_MODEL_NAME=your_model_name\n"
|
|
31
|
-
"2. 直接设置环境变量:\n"
|
|
32
|
-
" export OPENAI_API_KEY=your_api_key\n"
|
|
33
|
-
" export OPENAI_API_BASE=your_api_base\n"
|
|
34
|
-
" export OPENAI_MODEL_NAME=your_model_name"
|
|
35
|
-
)
|
|
36
|
-
PrettyOutput.print(message, OutputType.INFO)
|
|
37
22
|
PrettyOutput.print("OPENAI_API_KEY 未设置", OutputType.WARNING)
|
|
38
23
|
|
|
39
24
|
self.base_url = os.getenv("OPENAI_API_BASE", "https://api.openai.com/v1")
|
|
@@ -9,16 +9,11 @@ from typing import Dict, Generator, List, Tuple
|
|
|
9
9
|
|
|
10
10
|
import requests
|
|
11
11
|
from PIL import Image
|
|
12
|
-
from rich import box
|
|
13
|
-
from rich.live import Live
|
|
14
|
-
from rich.panel import Panel
|
|
15
|
-
from rich.text import Text
|
|
16
12
|
from yaspin import yaspin
|
|
17
13
|
from yaspin.api import Yaspin
|
|
18
14
|
from yaspin.spinners import Spinners
|
|
19
15
|
|
|
20
16
|
from jarvis.jarvis_platform.base import BasePlatform
|
|
21
|
-
from jarvis.jarvis_utils.config import get_data_dir
|
|
22
17
|
from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
|
23
18
|
from jarvis.jarvis_utils.utils import while_success
|
|
24
19
|
|
|
@@ -43,25 +38,6 @@ class YuanbaoPlatform(BasePlatform):
|
|
|
43
38
|
self.agent_id = os.getenv("YUANBAO_AGENT_ID") # 代理ID
|
|
44
39
|
|
|
45
40
|
if not self.cookies:
|
|
46
|
-
message = (
|
|
47
|
-
"需要设置 YUANBAO_COOKIES 和 YUANBAO_AGENT_ID 才能使用 Jarvis 的元宝功能。请按照以下步骤操作:\n"
|
|
48
|
-
"1. 获取元宝 API 参数:\n"
|
|
49
|
-
" • 访问元宝平台: https://yuanbao.tencent.com\n"
|
|
50
|
-
" • 登录您的账户\n"
|
|
51
|
-
" • 打开浏览器开发者工具 (F12 或右键 -> 检查)\n"
|
|
52
|
-
" • 切换到网络标签\n"
|
|
53
|
-
" • 发送任意消息\n"
|
|
54
|
-
" • 查看请求中的 Cookie 和 AgentID 值(具体位置见README.md中截图)\n"
|
|
55
|
-
"2. 设置环境变量:\n"
|
|
56
|
-
" • 方法 1: 创建或编辑配置文件:\n"
|
|
57
|
-
f" echo 'YUANBAO_COOKIES=your_cookies_here' >> {get_data_dir()}/env\n"
|
|
58
|
-
f" echo 'YUANBAO_AGENT_ID=your_agent_id_here' >> {get_data_dir()}/env\n"
|
|
59
|
-
" • 方法 2: 直接设置环境变量:\n"
|
|
60
|
-
" export YUANBAO_COOKIES=your_cookies_here\n"
|
|
61
|
-
" export YUANBAO_AGENT_ID=your_agent_id_here\n"
|
|
62
|
-
"设置后,重新运行 Jarvis。"
|
|
63
|
-
)
|
|
64
|
-
PrettyOutput.print(message, OutputType.INFO)
|
|
65
41
|
PrettyOutput.print("YUANBAO_COOKIES 未设置", OutputType.WARNING)
|
|
66
42
|
|
|
67
43
|
self.system_message = "" # 系统消息,用于初始化对话
|
|
@@ -8,7 +8,7 @@ from typing import Optional
|
|
|
8
8
|
from sympy import false
|
|
9
9
|
|
|
10
10
|
from jarvis.jarvis_platform.registry import PlatformRegistry
|
|
11
|
-
from jarvis.jarvis_utils.config import get_shell_name
|
|
11
|
+
from jarvis.jarvis_utils.config import get_shell_name, set_config
|
|
12
12
|
from jarvis.jarvis_utils.input import get_multiline_input
|
|
13
13
|
from jarvis.jarvis_utils.utils import init_env
|
|
14
14
|
|
|
@@ -90,7 +90,7 @@ def process_request(request: str) -> Optional[str]:
|
|
|
90
90
|
|
|
91
91
|
# 规则
|
|
92
92
|
1. 只输出命令
|
|
93
|
-
2.
|
|
93
|
+
2. 不要输出任何命令之外的内容
|
|
94
94
|
3. 单行输出
|
|
95
95
|
4. 多个命令用&&连接
|
|
96
96
|
|
|
@@ -116,8 +116,11 @@ def process_request(request: str) -> Optional[str]:
|
|
|
116
116
|
return None
|
|
117
117
|
|
|
118
118
|
def main() -> int:
|
|
119
|
-
# 创建参数解析器
|
|
119
|
+
# 创建参数解析器
|
|
120
120
|
init_env("")
|
|
121
|
+
|
|
122
|
+
set_config("JARVIS_PRINT_PROMPT", "false")
|
|
123
|
+
|
|
121
124
|
parser = argparse.ArgumentParser(
|
|
122
125
|
description="将自然语言要求转换为shell命令",
|
|
123
126
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
jarvis/jarvis_tools/code_plan.py
CHANGED
|
@@ -92,7 +92,6 @@ class CodePlanTool:
|
|
|
92
92
|
tool_registry.use_tools([
|
|
93
93
|
"execute_script",
|
|
94
94
|
"read_code",
|
|
95
|
-
"ask_codebase",
|
|
96
95
|
"search_web",
|
|
97
96
|
"ask_user"
|
|
98
97
|
])
|
|
@@ -157,7 +156,7 @@ class CodePlanTool:
|
|
|
157
156
|
|
|
158
157
|
## 工作流程
|
|
159
158
|
1. **需求理解阶段**:
|
|
160
|
-
- 使用
|
|
159
|
+
- 使用execute_script工具和read_code工具理解代码
|
|
161
160
|
- 必要时使用search_web搜索补充信息
|
|
162
161
|
- 使用ask_user工具向用户确认模糊点
|
|
163
162
|
|
|
@@ -185,7 +184,6 @@ class CodePlanTool:
|
|
|
185
184
|
|
|
186
185
|
## 工具使用优先级
|
|
187
186
|
1. **代码查询工具**:
|
|
188
|
-
- ask_codebase: 查询功能位置和实现
|
|
189
187
|
- fd/rg: 查找文件和代码模式
|
|
190
188
|
- read_code: 读取文件内容
|
|
191
189
|
|
jarvis/jarvis_tools/edit_file.py
CHANGED
|
@@ -156,7 +156,7 @@ class FileSearchReplaceTool:
|
|
|
156
156
|
with yaspin(text=f"正在处理文件 {file_path}...", color="cyan") as spinner:
|
|
157
157
|
success, temp_content = fast_edit(file_path, changes, spinner)
|
|
158
158
|
if not success:
|
|
159
|
-
success, temp_content = slow_edit(file_path, yaml.safe_dump(changes), spinner)
|
|
159
|
+
success, temp_content = slow_edit(file_path, yaml.safe_dump(changes, allow_unicode=True), spinner)
|
|
160
160
|
|
|
161
161
|
# 只有当所有替换操作都成功时,才写回文件
|
|
162
162
|
if success and (temp_content != original_content or not file_exists):
|