jarvis-ai-assistant 0.1.180__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 +28 -58
- jarvis/jarvis_dev/main.py +66 -112
- jarvis/jarvis_platform/base.py +4 -2
- jarvis/jarvis_platform/yuanbao.py +0 -1
- jarvis/jarvis_tools/code_plan.py +1 -3
- jarvis/jarvis_tools/execute_script.py +31 -8
- jarvis/jarvis_utils/builtin_replace_map.py +0 -48
- jarvis/jarvis_utils/config.py +8 -8
- jarvis/jarvis_utils/git_utils.py +61 -1
- jarvis/jarvis_utils/utils.py +32 -3
- {jarvis_ai_assistant-0.1.180.dist-info → jarvis_ai_assistant-0.1.181.dist-info}/METADATA +4 -5
- {jarvis_ai_assistant-0.1.180.dist-info → jarvis_ai_assistant-0.1.181.dist-info}/RECORD +18 -20
- {jarvis_ai_assistant-0.1.180.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.180.dist-info → jarvis_ai_assistant-0.1.181.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.1.180.dist-info → jarvis_ai_assistant-0.1.181.dist-info}/licenses/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.180.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:
|
|
@@ -14,7 +14,6 @@ from yaspin.api import Yaspin
|
|
|
14
14
|
from yaspin.spinners import Spinners
|
|
15
15
|
|
|
16
16
|
from jarvis.jarvis_platform.base import BasePlatform
|
|
17
|
-
from jarvis.jarvis_utils.config import get_data_dir
|
|
18
17
|
from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
|
19
18
|
from jarvis.jarvis_utils.utils import while_success
|
|
20
19
|
|
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
|
|
|
@@ -61,6 +61,30 @@ class ScriptTool:
|
|
|
61
61
|
"g++": "cpp",
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
def get_display_output(self, file_path: str) -> str:
|
|
65
|
+
"""消除控制字符,得到用户实际看到的文本,去除script命令首尾行"""
|
|
66
|
+
import re
|
|
67
|
+
# 读取文件内容并尝试多种编码
|
|
68
|
+
with open(file_path, 'rb') as f:
|
|
69
|
+
data = f.read()
|
|
70
|
+
|
|
71
|
+
import pyte
|
|
72
|
+
screen = pyte.Screen(300, 100000)
|
|
73
|
+
stream = pyte.ByteStream(screen)
|
|
74
|
+
stream.feed(data)
|
|
75
|
+
|
|
76
|
+
# 清理每行右侧空格,并过滤空行
|
|
77
|
+
cleaned = []
|
|
78
|
+
cleaned = []
|
|
79
|
+
for y in range(screen.lines):
|
|
80
|
+
line = screen.buffer[y]
|
|
81
|
+
stripped = "".join(
|
|
82
|
+
char.data for char in line.values()
|
|
83
|
+
).rstrip()
|
|
84
|
+
if stripped:
|
|
85
|
+
cleaned.append(stripped)
|
|
86
|
+
return "\n".join(cleaned[1:-1])
|
|
87
|
+
|
|
64
88
|
def _execute_script_with_interpreter(self, interpreter: str, script_content: str) -> Dict[str, Any]:
|
|
65
89
|
"""Execute a script with the specified interpreter
|
|
66
90
|
|
|
@@ -90,13 +114,8 @@ class ScriptTool:
|
|
|
90
114
|
|
|
91
115
|
# Read and process output file
|
|
92
116
|
try:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
# Remove header and footer added by script command (if any)
|
|
96
|
-
if output:
|
|
97
|
-
lines = output.splitlines()
|
|
98
|
-
if len(lines) > 2:
|
|
99
|
-
output = "\n".join(lines[1:-1])
|
|
117
|
+
# 消除控制字符,得到用户实际看到的文本
|
|
118
|
+
output = self.get_display_output(output_file)
|
|
100
119
|
except Exception as e:
|
|
101
120
|
output = f"读取输出文件失败: {str(e)}"
|
|
102
121
|
|
|
@@ -150,4 +169,8 @@ class ScriptTool:
|
|
|
150
169
|
"success": False,
|
|
151
170
|
"stdout": "",
|
|
152
171
|
"stderr": str(e)
|
|
153
|
-
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if __name__ == "__main__":
|
|
175
|
+
script_tool = ScriptTool()
|
|
176
|
+
print(script_tool.get_display_output("/home/wangmaobin/code/Jarvis/a.txt"))
|
|
@@ -8,27 +8,6 @@
|
|
|
8
8
|
from jarvis.jarvis_utils.tag import ct, ot
|
|
9
9
|
|
|
10
10
|
BUILTIN_REPLACE_MAP = {
|
|
11
|
-
"CodeBase": {
|
|
12
|
-
"append": True,
|
|
13
|
-
"template": f"""
|
|
14
|
-
请使用ask_codebase工具查询代码库,必须严格遵守以下工具调用格式:
|
|
15
|
-
|
|
16
|
-
{ot("TOOL_CALL")}
|
|
17
|
-
want: 想要从执行结果中获取到的信息
|
|
18
|
-
name: ask_codebase
|
|
19
|
-
arguments:
|
|
20
|
-
question: "与xxx功能相关的文件有哪些?"
|
|
21
|
-
{ct("TOOL_CALL")}
|
|
22
|
-
|
|
23
|
-
可以使用的提问格式包括:
|
|
24
|
-
1. 与xxx功能相关的文件有哪些?
|
|
25
|
-
2. 要实现xxx,应该要修改哪些文件?
|
|
26
|
-
3. xxx功能是怎么实现的?
|
|
27
|
-
4. xxx模块的入口函数是什么?
|
|
28
|
-
5. xxx功能的测试用例在哪里?
|
|
29
|
-
""",
|
|
30
|
-
"description": "查询代码库"
|
|
31
|
-
},
|
|
32
11
|
"Web": {
|
|
33
12
|
"append": True,
|
|
34
13
|
"template": f"""
|
|
@@ -50,27 +29,6 @@ arguments:
|
|
|
50
29
|
""",
|
|
51
30
|
"description": "网页搜索"
|
|
52
31
|
},
|
|
53
|
-
"Methodology": {
|
|
54
|
-
"append": True,
|
|
55
|
-
"template": f"""
|
|
56
|
-
请使用find_methodology工具查找相关方法论,必须严格遵守以下工具调用格式:
|
|
57
|
-
|
|
58
|
-
{ot("TOOL_CALL")}
|
|
59
|
-
want: 想要从执行结果中获取到的信息
|
|
60
|
-
name: find_methodology
|
|
61
|
-
arguments:
|
|
62
|
-
query: "关于xxx的方法论有哪些?"
|
|
63
|
-
{ct("TOOL_CALL")}
|
|
64
|
-
|
|
65
|
-
可以使用的提问格式包括:
|
|
66
|
-
1. 关于xxx的方法论有哪些?
|
|
67
|
-
2. 如何解决xxx问题?
|
|
68
|
-
3. xxx的最佳实践是什么?
|
|
69
|
-
4. 处理xxx的标准流程是什么?
|
|
70
|
-
5. 实现xxx的参考方案有哪些?
|
|
71
|
-
""",
|
|
72
|
-
"description": "查找相关方法论"
|
|
73
|
-
},
|
|
74
32
|
"Plan": {
|
|
75
33
|
"append": True,
|
|
76
34
|
"template": f"""
|
|
@@ -111,12 +69,6 @@ code_plan工具将:
|
|
|
111
69
|
"append": False,
|
|
112
70
|
"template": f"""
|
|
113
71
|
请使用工具在当前目录下查找与以下功能相关的文件:
|
|
114
|
-
"""
|
|
115
|
-
},
|
|
116
|
-
"FindMethodology": {
|
|
117
|
-
"append": False,
|
|
118
|
-
"template": f"""
|
|
119
|
-
请使用find_methodology工具查找相关方法论:
|
|
120
72
|
"""
|
|
121
73
|
},
|
|
122
74
|
"Dev": {
|