feihong-code 0.5.1 → 0.6.0

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +465 -405
  2. package/README.md +59 -0
  3. package/dist/agent/code-writer.js +6 -3
  4. package/dist/agent/code-writer.js.map +1 -1
  5. package/dist/agent/experience.js +105 -70
  6. package/dist/agent/experience.js.map +1 -1
  7. package/dist/agent/orchestrator.js +103 -21
  8. package/dist/agent/orchestrator.js.map +1 -1
  9. package/dist/agent/planner.js +30 -7
  10. package/dist/agent/planner.js.map +1 -1
  11. package/dist/agent/prompts.js +9 -0
  12. package/dist/agent/prompts.js.map +1 -1
  13. package/dist/agent/self-heal.js +43 -13
  14. package/dist/agent/self-heal.js.map +1 -1
  15. package/dist/cli/run.js +13 -14
  16. package/dist/cli/run.js.map +1 -1
  17. package/dist/cli/version.js +1 -1
  18. package/dist/enterprise/audit.js +70 -11
  19. package/dist/enterprise/audit.js.map +1 -1
  20. package/dist/models/model-router.js +83 -23
  21. package/dist/models/model-router.js.map +1 -1
  22. package/dist/models/model.dto.js +25 -3
  23. package/dist/models/model.dto.js.map +1 -1
  24. package/dist/models/providers/ollama.provider.js +12 -0
  25. package/dist/models/providers/ollama.provider.js.map +1 -1
  26. package/dist/models/providers/openai-compatible.provider.js +14 -1
  27. package/dist/models/providers/openai-compatible.provider.js.map +1 -1
  28. package/dist/self-evolve/hook.js +2 -2
  29. package/dist/self-evolve/hook.js.map +1 -1
  30. package/dist/self-evolve/hook.ts +80 -0
  31. package/dist/self-evolve/manager.d.ts +8 -0
  32. package/dist/self-evolve/manager.js +401 -0
  33. package/dist/shared/errors.js +6 -2
  34. package/dist/shared/errors.js.map +1 -1
  35. package/dist/shared/secure-store.js +117 -0
  36. package/dist/shared/secure-store.js.map +1 -0
  37. package/dist/tools/mcp/mcp-client.js +35 -13
  38. package/dist/tools/mcp/mcp-client.js.map +1 -1
  39. package/dist/tools/shell/exec.js +47 -3
  40. package/dist/tools/shell/exec.js.map +1 -1
  41. package/dist/tools/shell/run-shell.tool.js +33 -6
  42. package/dist/tools/shell/run-shell.tool.js.map +1 -1
  43. package/dist/tools/tool.registry.js +32 -0
  44. package/dist/tools/tool.registry.js.map +1 -1
  45. package/dist/web/auth.js +143 -7
  46. package/dist/web/auth.js.map +1 -1
  47. package/dist/web/public/css/style.css +1546 -0
  48. package/dist/web/public/index.html +806 -3253
  49. package/dist/web/public/js/api.js +309 -0
  50. package/dist/web/public/js/app.js +1472 -0
  51. package/dist/web/public/js/ui.js +832 -0
  52. package/dist/web/public/js/utils.js +170 -0
  53. package/dist/web/server.js +224 -77
  54. package/dist/web/server.js.map +1 -1
  55. package/dist/web/task-queue.js +128 -10
  56. package/dist/web/task-queue.js.map +1 -1
  57. package/docs/App/344/275/277/347/224/250/350/257/264/346/230/216/344/271/246.md +299 -0
  58. package/docs/App/346/212/200/346/234/257/350/257/264/346/230/216/344/271/246.md +554 -0
  59. package/docs/SELF-EVOLVE-GUIDE.md +313 -0
  60. package/docs/error-codes.md +198 -0
  61. package/docs/screenshots/cli-demo.png +0 -0
  62. package/docs/screenshots/feature-comparison.png +0 -0
  63. package/docs/screenshots/web-console.png +0 -0
  64. package/docs//351/241/265/351/235/242/345/212/237/350/203/275/345/244/215/347/233/230/344/270/216/345/206/222/347/203/237/346/265/213/350/257/225/346/212/245/345/221/212.html +117 -0
  65. package/package.json +9 -15
  66. package/tool-schema.json +198 -127
  67. package/dist/web/public/index.html.tmp +0 -3117
  68. package/dist/web/public/index_new.html +0 -3196
package/tool-schema.json CHANGED
@@ -1,127 +1,198 @@
1
- {
2
- "name": "feihong-code",
3
- "version": "0.2.1",
4
- "description": "Terminal AI Coding Agent 终端 AI 编程智能体",
5
- "tools": [
6
- {
7
- "name": "write_file",
8
- "description": "写入或覆盖文件内容。如果文件不存在则创建,如果已存在则完全替换。",
9
- "parameters": {
10
- "type": "object",
11
- "properties": {
12
- "path": { "type": "string", "description": "文件相对路径(相对于工作区根目录)" },
13
- "content": { "type": "string", "description": "文件的完整内容" }
14
- },
15
- "required": ["path", "content"],
16
- "additionalProperties": false
17
- },
18
- "example": { "path": "src/main.ts", "content": "export function hello() { return 'world'; }" }
19
- },
20
- {
21
- "name": "edit_file",
22
- "description": "在文件中插入、删除或替换文本块。使用 oldText/newText 精确匹配。",
23
- "parameters": {
24
- "type": "object",
25
- "properties": {
26
- "path": { "type": "string", "description": "目标文件路径" },
27
- "oldText": { "type": "string", "description": "待替换的原文本(必须唯一存在于文件中)" },
28
- "newText": { "type": "string", "description": "替换后的新文本" }
29
- },
30
- "required": ["path", "oldText", "newText"],
31
- "additionalProperties": false
32
- },
33
- "example": { "path": "src/calc.ts", "oldText": "return a - b;", "newText": "return a + b;" }
34
- },
35
- {
36
- "name": "read_file",
37
- "description": "读取文件的全部内容。",
38
- "parameters": {
39
- "type": "object",
40
- "properties": {
41
- "path": { "type": "string", "description": "文件相对路径" }
42
- },
43
- "required": ["path"],
44
- "additionalProperties": false
45
- },
46
- "example": { "path": "package.json" }
47
- },
48
- {
49
- "name": "list_files",
50
- "description": "列出目录下的文件和子目录。",
51
- "parameters": {
52
- "type": "object",
53
- "properties": {
54
- "path": { "type": "string", "description": "目录路径,默认为 '.'(工作区根)" }
55
- },
56
- "additionalProperties": false
57
- },
58
- "example": { "path": "src/" }
59
- },
60
- {
61
- "name": "grep",
62
- "description": "使用正则表达式在项目中搜索文本。",
63
- "parameters": {
64
- "type": "object",
65
- "properties": {
66
- "pattern": { "type": "string", "description": "正则表达式模式" },
67
- "path": { "type": "string", "description": "搜索起始目录,默认为工作区根" }
68
- },
69
- "required": ["pattern"],
70
- "additionalProperties": false
71
- },
72
- "example": { "pattern": "class.*Error", "path": "src/" }
73
- },
74
- {
75
- "name": "run_shell",
76
- "description": "在工作区内执行 shell 命令。命令需通过白名单验证。",
77
- "parameters": {
78
- "type": "object",
79
- "properties": {
80
- "command": { "type": "string", "description": "要执行的完整命令(如 'npm test'、'node index.js')" }
81
- },
82
- "required": ["command"],
83
- "additionalProperties": false
84
- },
85
- "example": { "command": "npm run typecheck" }
86
- },
87
- {
88
- "name": "build_check",
89
- "description": "检查项目是否能成功编译(运行 tsc --noEmit)。",
90
- "parameters": {
91
- "type": "object",
92
- "properties": {},
93
- "additionalProperties": false
94
- },
95
- "example": {}
96
- },
97
- {
98
- "name": "run_tests",
99
- "description": "运行测试套件并返回结果。",
100
- "parameters": {
101
- "type": "object",
102
- "properties": {},
103
- "additionalProperties": false
104
- },
105
- "example": {}
106
- }
107
- ],
108
- "toolCategories": {
109
- "file": ["write_file", "edit_file", "read_file", "list_files"],
110
- "search": ["grep"],
111
- "shell": ["run_shell"],
112
- "verify": ["build_check", "run_tests"]
113
- },
114
- "security": {
115
- "sandbox": "所有文件操作限制在工作区目录内",
116
- "approval": "危险操作(shell 命令、写入敏感文件)可能需要人工审批",
117
- "audit": "所有工具调用记录到 JSONL 事件日志"
118
- },
119
- "errorCodes": {
120
- "FH_4001": "配额超限 — 日预算已耗尽,等待次日重置或申请配额",
121
- "FH_4003": "权限拒绝 — 当前角色无权执行此操作,检查 RBAC 策略",
122
- "FH_5001": "模型调用失败 — 网络问题或 API Key 无效,检查 provider 配置",
123
- "FH_5002": "上下文压缩失败 — 对话过长,尝试使用 /plan 重新规划",
124
- "FH_6001": "文件路径越权 — 路径包含 '..' 或符号链接,检查沙箱规则"
125
- },
126
- "authoredBy": "晋江市飞虹智科技企业管理有限公司 · 飞扬企源研发中心 · 负责人:吴赐虹"
127
- }
1
+ {
2
+ "name": "feihong-code",
3
+ "version": "0.6.0",
4
+ "description": "Terminal AI Coding Agent 鈥?缁堢 AI 缂栫▼鏅鸿兘浣?,
5
+ "tools": [
6
+ {
7
+ "name": "write_file",
8
+ "description": "鍐欏叆鎴栬鐩栨枃浠跺唴瀹广€傚鏋滄枃浠朵笉瀛樺湪鍒欏垱寤猴紝濡傛灉宸插瓨鍦ㄥ垯瀹屽叏鏇挎崲銆?,
9
+ "parameters": {
10
+ "type": "object",
11
+ "properties": {
12
+ "path": {
13
+ "type": "string",
14
+ "description": "鏂囦欢鐩稿璺緞锛堢浉瀵逛簬宸ヤ綔鍖烘牴鐩綍锛?
15
+ },
16
+ "content": {
17
+ "type": "string",
18
+ "description": "鏂囦欢鐨勫畬鏁村唴瀹?
19
+ }
20
+ },
21
+ "required": [
22
+ "path",
23
+ "content"
24
+ ],
25
+ "additionalProperties": false
26
+ },
27
+ "example": {
28
+ "path": "src/main.ts",
29
+ "content": "export function hello() { return 'world'; }"
30
+ }
31
+ },
32
+ {
33
+ "name": "edit_file",
34
+ "description": "鍦ㄦ枃浠朵腑鎻掑叆銆佸垹闄ゆ垨鏇挎崲鏂囨湰鍧椼€備娇鐢?oldText/newText 绮剧‘鍖归厤銆?,
35
+ "parameters": {
36
+ "type": "object",
37
+ "properties": {
38
+ "path": {
39
+ "type": "string",
40
+ "description": "鐩爣鏂囦欢璺緞"
41
+ },
42
+ "oldText": {
43
+ "type": "string",
44
+ "description": "寰呮浛鎹㈢殑鍘熸枃鏈紙蹇呴』鍞竴瀛樺湪浜庢枃浠朵腑锛?
45
+ },
46
+ "newText": {
47
+ "type": "string",
48
+ "description": "鏇挎崲鍚庣殑鏂版枃鏈?
49
+ }
50
+ },
51
+ "required": [
52
+ "path",
53
+ "oldText",
54
+ "newText"
55
+ ],
56
+ "additionalProperties": false
57
+ },
58
+ "example": {
59
+ "path": "src/calc.ts",
60
+ "oldText": "return a - b;",
61
+ "newText": "return a + b;"
62
+ }
63
+ },
64
+ {
65
+ "name": "read_file",
66
+ "description": "璇诲彇鏂囦欢鐨勫叏閮ㄥ唴瀹广€?,
67
+ "parameters": {
68
+ "type": "object",
69
+ "properties": {
70
+ "path": {
71
+ "type": "string",
72
+ "description": "鏂囦欢鐩稿璺緞"
73
+ }
74
+ },
75
+ "required": [
76
+ "path"
77
+ ],
78
+ "additionalProperties": false
79
+ },
80
+ "example": {
81
+ "path": "package.json"
82
+ }
83
+ },
84
+ {
85
+ "name": "list_files",
86
+ "description": "鍒楀嚭鐩綍涓嬬殑鏂囦欢鍜屽瓙鐩綍銆?,
87
+ "parameters": {
88
+ "type": "object",
89
+ "properties": {
90
+ "path": {
91
+ "type": "string",
92
+ "description": "鐩綍璺緞锛岄粯璁や负 '.'锛堝伐浣滃尯鏍癸級"
93
+ }
94
+ },
95
+ "additionalProperties": false
96
+ },
97
+ "example": {
98
+ "path": "src/"
99
+ }
100
+ },
101
+ {
102
+ "name": "grep",
103
+ "description": "浣跨敤姝e垯琛ㄨ揪寮忓湪椤圭洰涓悳绱㈡枃鏈€?,
104
+ "parameters": {
105
+ "type": "object",
106
+ "properties": {
107
+ "pattern": {
108
+ "type": "string",
109
+ "description": "姝e垯琛ㄨ揪寮忔ā寮?
110
+ },
111
+ "path": {
112
+ "type": "string",
113
+ "description": "鎼滅储璧峰鐩綍锛岄粯璁や负宸ヤ綔鍖烘牴"
114
+ }
115
+ },
116
+ "required": [
117
+ "pattern"
118
+ ],
119
+ "additionalProperties": false
120
+ },
121
+ "example": {
122
+ "pattern": "class.*Error",
123
+ "path": "src/"
124
+ }
125
+ },
126
+ {
127
+ "name": "run_shell",
128
+ "description": "鍦ㄥ伐浣滃尯鍐呮墽琛?shell 鍛戒护銆傚懡浠ら渶閫氳繃鐧藉悕鍗曢獙璇併€?,
129
+ "parameters": {
130
+ "type": "object",
131
+ "properties": {
132
+ "command": {
133
+ "type": "string",
134
+ "description": "瑕佹墽琛岀殑瀹屾暣鍛戒护锛堝 'npm test'銆?node index.js'锛?
135
+ }
136
+ },
137
+ "required": [
138
+ "command"
139
+ ],
140
+ "additionalProperties": false
141
+ },
142
+ "example": {
143
+ "command": "npm run typecheck"
144
+ }
145
+ },
146
+ {
147
+ "name": "build_check",
148
+ "description": "妫€鏌ラ」鐩槸鍚﹁兘鎴愬姛缂栬瘧锛堣繍琛?tsc --noEmit锛夈€?,
149
+ "parameters": {
150
+ "type": "object",
151
+ "properties": {},
152
+ "additionalProperties": false
153
+ },
154
+ "example": {}
155
+ },
156
+ {
157
+ "name": "run_tests",
158
+ "description": "杩愯娴嬭瘯濂椾欢骞惰繑鍥炵粨鏋溿€?,
159
+ "parameters": {
160
+ "type": "object",
161
+ "properties": {},
162
+ "additionalProperties": false
163
+ },
164
+ "example": {}
165
+ }
166
+ ],
167
+ "toolCategories": {
168
+ "file": [
169
+ "write_file",
170
+ "edit_file",
171
+ "read_file",
172
+ "list_files"
173
+ ],
174
+ "search": [
175
+ "grep"
176
+ ],
177
+ "shell": [
178
+ "run_shell"
179
+ ],
180
+ "verify": [
181
+ "build_check",
182
+ "run_tests"
183
+ ]
184
+ },
185
+ "security": {
186
+ "sandbox": "鎵€鏈夋枃浠舵搷浣滈檺鍒跺湪宸ヤ綔鍖虹洰褰曞唴",
187
+ "approval": "鍗遍櫓鎿嶄綔锛坰hell 鍛戒护銆佸啓鍏ユ晱鎰熸枃浠讹級鍙兘闇€瑕佷汉宸ュ鎵?,
188
+ "audit": "鎵€鏈夊伐鍏疯皟鐢ㄨ褰曞埌 JSONL 浜嬩欢鏃ュ織"
189
+ },
190
+ "errorCodes": {
191
+ "FH_4001": "閰嶉瓒呴檺 鈥?鏃ラ绠楀凡鑰楀敖锛岀瓑寰呮鏃ラ噸缃垨鐢宠閰嶉",
192
+ "FH_4003": "鏉冮檺鎷掔粷 鈥?褰撳墠瑙掕壊鏃犳潈鎵ц姝ゆ搷浣滐紝妫€鏌?RBAC 绛栫暐",
193
+ "FH_5001": "妯″瀷璋冪敤澶辫触 鈥?缃戠粶闂鎴?API Key 鏃犳晥锛屾鏌?provider 閰嶇疆",
194
+ "FH_5002": "涓婁笅鏂囧帇缂╁け璐?鈥?瀵硅瘽杩囬暱锛屽皾璇曚娇鐢?/plan 閲嶆柊瑙勫垝",
195
+ "FH_6001": "鏂囦欢璺緞瓒婃潈 鈥?璺緞鍖呭惈 '..' 鎴栫鍙烽摼鎺ワ紝妫€鏌ユ矙绠辫鍒?
196
+ },
197
+ "authoredBy": "鏅嬫睙甯傞铏规櫤绉戞妧浼佷笟绠$悊鏈夐檺鍏徃 路 椋炴壃浼佹簮鐮斿彂涓績 路 璐熻矗浜猴細鍚磋祼铏?
198
+ }