fivosense 0.1.4 → 0.1.6
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.
- package/COMPLETE_SUMMARY.md +412 -0
- package/DOCUMENTATION.md +608 -0
- package/FINAL_VERIFICATION.md +316 -0
- package/README.md +198 -316
- package/VERIFICATION_CHECKLIST.md +307 -0
- package/dist/ai/client.d.ts +27 -0
- package/dist/ai/client.d.ts.map +1 -0
- package/dist/ai/client.js +167 -0
- package/dist/ai/client.js.map +1 -0
- package/dist/ai/judge.d.ts +3 -3
- package/dist/ai/judge.d.ts.map +1 -1
- package/dist/ai/judge.js +43 -14
- package/dist/ai/judge.js.map +1 -1
- package/dist/cli/index.js +48 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/core/orchestrator.d.ts +31 -0
- package/dist/core/orchestrator.d.ts.map +1 -0
- package/dist/core/orchestrator.js +205 -0
- package/dist/core/orchestrator.js.map +1 -0
- package/dist/core/scope.d.ts +29 -0
- package/dist/core/scope.d.ts.map +1 -0
- package/dist/core/scope.js +143 -0
- package/dist/core/scope.js.map +1 -0
- package/dist/engine/adversary.d.ts +3 -2
- package/dist/engine/adversary.d.ts.map +1 -1
- package/dist/engine/adversary.js +43 -12
- package/dist/engine/adversary.js.map +1 -1
- package/dist/engine/poc.d.ts +20 -0
- package/dist/engine/poc.d.ts.map +1 -0
- package/dist/engine/poc.js +176 -0
- package/dist/engine/poc.js.map +1 -0
- package/dist/features/index.d.ts +7 -0
- package/dist/features/index.d.ts.map +1 -0
- package/dist/features/index.js +7 -0
- package/dist/features/index.js.map +1 -0
- package/dist/hooks/git.d.ts +31 -0
- package/dist/hooks/git.d.ts.map +1 -0
- package/dist/hooks/git.js +155 -0
- package/dist/hooks/git.js.map +1 -0
- package/mcp/index.js +48 -20
- package/mcp/package-lock.json +382 -0
- package/mcp/package.json +1 -1
- package/package.json +1 -1
- package/src/ai/client.ts +219 -0
- package/src/ai/judge.ts +51 -14
- package/src/cli/index.ts +46 -7
- package/src/core/orchestrator.ts +259 -0
- package/src/core/scope.ts +168 -0
- package/src/engine/adversary.ts +48 -12
- package/src/engine/poc.ts +212 -0
- package/src/features/index.ts +7 -0
- package/src/hooks/git.ts +187 -0
- package/vscode-extension/fivosense-vscode-0.1.0.vsix +0 -0
- package/vscode-extension/package-lock.json +4 -4
- package/vscode-extension/package.json +3 -3
- package/vscode-extension/src/extension.ts +65 -11
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fivosense-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"lockfileVersion": 3,
|
|
5
|
+
"requires": true,
|
|
6
|
+
"packages": {
|
|
7
|
+
"": {
|
|
8
|
+
"name": "fivosense-mcp",
|
|
9
|
+
"version": "0.1.0",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@modelcontextprotocol/sdk": "^0.5.0",
|
|
13
|
+
"fivosense": "^0.1.5"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"fivosense-mcp": "index.js"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=20.0.0"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"node_modules/@babel/code-frame": {
|
|
23
|
+
"version": "7.29.7",
|
|
24
|
+
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz",
|
|
25
|
+
"integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@babel/helper-validator-identifier": "^7.29.7",
|
|
29
|
+
"js-tokens": "^4.0.0",
|
|
30
|
+
"picocolors": "^1.1.1"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=6.9.0"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"node_modules/@babel/generator": {
|
|
37
|
+
"version": "7.29.7",
|
|
38
|
+
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.7.tgz",
|
|
39
|
+
"integrity": "sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ==",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@babel/parser": "^7.29.7",
|
|
43
|
+
"@babel/types": "^7.29.7",
|
|
44
|
+
"@jridgewell/gen-mapping": "^0.3.12",
|
|
45
|
+
"@jridgewell/trace-mapping": "^0.3.28",
|
|
46
|
+
"jsesc": "^3.0.2"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=6.9.0"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"node_modules/@babel/helper-globals": {
|
|
53
|
+
"version": "7.29.7",
|
|
54
|
+
"resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz",
|
|
55
|
+
"integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==",
|
|
56
|
+
"license": "MIT",
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=6.9.0"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"node_modules/@babel/helper-string-parser": {
|
|
62
|
+
"version": "7.29.7",
|
|
63
|
+
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz",
|
|
64
|
+
"integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==",
|
|
65
|
+
"license": "MIT",
|
|
66
|
+
"engines": {
|
|
67
|
+
"node": ">=6.9.0"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"node_modules/@babel/helper-validator-identifier": {
|
|
71
|
+
"version": "7.29.7",
|
|
72
|
+
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz",
|
|
73
|
+
"integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==",
|
|
74
|
+
"license": "MIT",
|
|
75
|
+
"engines": {
|
|
76
|
+
"node": ">=6.9.0"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"node_modules/@babel/parser": {
|
|
80
|
+
"version": "7.29.7",
|
|
81
|
+
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz",
|
|
82
|
+
"integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==",
|
|
83
|
+
"license": "MIT",
|
|
84
|
+
"dependencies": {
|
|
85
|
+
"@babel/types": "^7.29.7"
|
|
86
|
+
},
|
|
87
|
+
"bin": {
|
|
88
|
+
"parser": "bin/babel-parser.js"
|
|
89
|
+
},
|
|
90
|
+
"engines": {
|
|
91
|
+
"node": ">=6.0.0"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"node_modules/@babel/template": {
|
|
95
|
+
"version": "7.29.7",
|
|
96
|
+
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz",
|
|
97
|
+
"integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==",
|
|
98
|
+
"license": "MIT",
|
|
99
|
+
"dependencies": {
|
|
100
|
+
"@babel/code-frame": "^7.29.7",
|
|
101
|
+
"@babel/parser": "^7.29.7",
|
|
102
|
+
"@babel/types": "^7.29.7"
|
|
103
|
+
},
|
|
104
|
+
"engines": {
|
|
105
|
+
"node": ">=6.9.0"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"node_modules/@babel/traverse": {
|
|
109
|
+
"version": "7.29.7",
|
|
110
|
+
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.7.tgz",
|
|
111
|
+
"integrity": "sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw==",
|
|
112
|
+
"license": "MIT",
|
|
113
|
+
"dependencies": {
|
|
114
|
+
"@babel/code-frame": "^7.29.7",
|
|
115
|
+
"@babel/generator": "^7.29.7",
|
|
116
|
+
"@babel/helper-globals": "^7.29.7",
|
|
117
|
+
"@babel/parser": "^7.29.7",
|
|
118
|
+
"@babel/template": "^7.29.7",
|
|
119
|
+
"@babel/types": "^7.29.7",
|
|
120
|
+
"debug": "^4.3.1"
|
|
121
|
+
},
|
|
122
|
+
"engines": {
|
|
123
|
+
"node": ">=6.9.0"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"node_modules/@babel/types": {
|
|
127
|
+
"version": "7.29.7",
|
|
128
|
+
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz",
|
|
129
|
+
"integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==",
|
|
130
|
+
"license": "MIT",
|
|
131
|
+
"dependencies": {
|
|
132
|
+
"@babel/helper-string-parser": "^7.29.7",
|
|
133
|
+
"@babel/helper-validator-identifier": "^7.29.7"
|
|
134
|
+
},
|
|
135
|
+
"engines": {
|
|
136
|
+
"node": ">=6.9.0"
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"node_modules/@jridgewell/gen-mapping": {
|
|
140
|
+
"version": "0.3.13",
|
|
141
|
+
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
|
142
|
+
"integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
|
|
143
|
+
"license": "MIT",
|
|
144
|
+
"dependencies": {
|
|
145
|
+
"@jridgewell/sourcemap-codec": "^1.5.0",
|
|
146
|
+
"@jridgewell/trace-mapping": "^0.3.24"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"node_modules/@jridgewell/resolve-uri": {
|
|
150
|
+
"version": "3.1.2",
|
|
151
|
+
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
|
|
152
|
+
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
|
|
153
|
+
"license": "MIT",
|
|
154
|
+
"engines": {
|
|
155
|
+
"node": ">=6.0.0"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"node_modules/@jridgewell/sourcemap-codec": {
|
|
159
|
+
"version": "1.5.5",
|
|
160
|
+
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
|
|
161
|
+
"integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
|
|
162
|
+
"license": "MIT"
|
|
163
|
+
},
|
|
164
|
+
"node_modules/@jridgewell/trace-mapping": {
|
|
165
|
+
"version": "0.3.31",
|
|
166
|
+
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
|
|
167
|
+
"integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
|
|
168
|
+
"license": "MIT",
|
|
169
|
+
"dependencies": {
|
|
170
|
+
"@jridgewell/resolve-uri": "^3.1.0",
|
|
171
|
+
"@jridgewell/sourcemap-codec": "^1.4.14"
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"node_modules/@modelcontextprotocol/sdk": {
|
|
175
|
+
"version": "0.5.0",
|
|
176
|
+
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-0.5.0.tgz",
|
|
177
|
+
"integrity": "sha512-RXgulUX6ewvxjAG0kOpLMEdXXWkzWgaoCGaA2CwNW7cQCIphjpJhjpHSiaPdVCnisjRF/0Cm9KWHUuIoeiAblQ==",
|
|
178
|
+
"license": "MIT",
|
|
179
|
+
"dependencies": {
|
|
180
|
+
"content-type": "^1.0.5",
|
|
181
|
+
"raw-body": "^3.0.0",
|
|
182
|
+
"zod": "^3.23.8"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"node_modules/bytes": {
|
|
186
|
+
"version": "3.1.2",
|
|
187
|
+
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
|
188
|
+
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
|
189
|
+
"license": "MIT",
|
|
190
|
+
"engines": {
|
|
191
|
+
"node": ">= 0.8"
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"node_modules/content-type": {
|
|
195
|
+
"version": "1.0.5",
|
|
196
|
+
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
|
197
|
+
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
|
198
|
+
"license": "MIT",
|
|
199
|
+
"engines": {
|
|
200
|
+
"node": ">= 0.6"
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
"node_modules/debug": {
|
|
204
|
+
"version": "4.4.3",
|
|
205
|
+
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
|
206
|
+
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
|
207
|
+
"license": "MIT",
|
|
208
|
+
"dependencies": {
|
|
209
|
+
"ms": "^2.1.3"
|
|
210
|
+
},
|
|
211
|
+
"engines": {
|
|
212
|
+
"node": ">=6.0"
|
|
213
|
+
},
|
|
214
|
+
"peerDependenciesMeta": {
|
|
215
|
+
"supports-color": {
|
|
216
|
+
"optional": true
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
"node_modules/depd": {
|
|
221
|
+
"version": "2.0.0",
|
|
222
|
+
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
|
223
|
+
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
|
224
|
+
"license": "MIT",
|
|
225
|
+
"engines": {
|
|
226
|
+
"node": ">= 0.8"
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
"node_modules/fivosense": {
|
|
230
|
+
"version": "0.1.5",
|
|
231
|
+
"resolved": "https://registry.npmjs.org/fivosense/-/fivosense-0.1.5.tgz",
|
|
232
|
+
"integrity": "sha512-82s3pGQQF4MOfqYkZsSPxFPkhjDcA4PJJ2wS1hzEqaPwKDsxLkRtuXl3mG64jT/I4hXStYOhu8Ui366LLJkegQ==",
|
|
233
|
+
"license": "MIT",
|
|
234
|
+
"dependencies": {
|
|
235
|
+
"@babel/parser": "^7.23.0",
|
|
236
|
+
"@babel/traverse": "^7.23.0",
|
|
237
|
+
"@babel/types": "^7.23.0"
|
|
238
|
+
},
|
|
239
|
+
"bin": {
|
|
240
|
+
"fivosense": "bin/fivosense.mjs"
|
|
241
|
+
},
|
|
242
|
+
"engines": {
|
|
243
|
+
"node": ">=20.0.0"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"node_modules/http-errors": {
|
|
247
|
+
"version": "2.0.1",
|
|
248
|
+
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
|
|
249
|
+
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
|
|
250
|
+
"license": "MIT",
|
|
251
|
+
"dependencies": {
|
|
252
|
+
"depd": "~2.0.0",
|
|
253
|
+
"inherits": "~2.0.4",
|
|
254
|
+
"setprototypeof": "~1.2.0",
|
|
255
|
+
"statuses": "~2.0.2",
|
|
256
|
+
"toidentifier": "~1.0.1"
|
|
257
|
+
},
|
|
258
|
+
"engines": {
|
|
259
|
+
"node": ">= 0.8"
|
|
260
|
+
},
|
|
261
|
+
"funding": {
|
|
262
|
+
"type": "opencollective",
|
|
263
|
+
"url": "https://opencollective.com/express"
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
"node_modules/iconv-lite": {
|
|
267
|
+
"version": "0.7.2",
|
|
268
|
+
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz",
|
|
269
|
+
"integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==",
|
|
270
|
+
"license": "MIT",
|
|
271
|
+
"dependencies": {
|
|
272
|
+
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
|
273
|
+
},
|
|
274
|
+
"engines": {
|
|
275
|
+
"node": ">=0.10.0"
|
|
276
|
+
},
|
|
277
|
+
"funding": {
|
|
278
|
+
"type": "opencollective",
|
|
279
|
+
"url": "https://opencollective.com/express"
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
"node_modules/inherits": {
|
|
283
|
+
"version": "2.0.4",
|
|
284
|
+
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
|
285
|
+
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
|
286
|
+
"license": "ISC"
|
|
287
|
+
},
|
|
288
|
+
"node_modules/js-tokens": {
|
|
289
|
+
"version": "4.0.0",
|
|
290
|
+
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
|
291
|
+
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
|
|
292
|
+
"license": "MIT"
|
|
293
|
+
},
|
|
294
|
+
"node_modules/jsesc": {
|
|
295
|
+
"version": "3.1.0",
|
|
296
|
+
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
|
|
297
|
+
"integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==",
|
|
298
|
+
"license": "MIT",
|
|
299
|
+
"bin": {
|
|
300
|
+
"jsesc": "bin/jsesc"
|
|
301
|
+
},
|
|
302
|
+
"engines": {
|
|
303
|
+
"node": ">=6"
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
"node_modules/ms": {
|
|
307
|
+
"version": "2.1.3",
|
|
308
|
+
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
|
309
|
+
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
|
310
|
+
"license": "MIT"
|
|
311
|
+
},
|
|
312
|
+
"node_modules/picocolors": {
|
|
313
|
+
"version": "1.1.1",
|
|
314
|
+
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
|
315
|
+
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
|
316
|
+
"license": "ISC"
|
|
317
|
+
},
|
|
318
|
+
"node_modules/raw-body": {
|
|
319
|
+
"version": "3.0.2",
|
|
320
|
+
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz",
|
|
321
|
+
"integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==",
|
|
322
|
+
"license": "MIT",
|
|
323
|
+
"dependencies": {
|
|
324
|
+
"bytes": "~3.1.2",
|
|
325
|
+
"http-errors": "~2.0.1",
|
|
326
|
+
"iconv-lite": "~0.7.0",
|
|
327
|
+
"unpipe": "~1.0.0"
|
|
328
|
+
},
|
|
329
|
+
"engines": {
|
|
330
|
+
"node": ">= 0.10"
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
"node_modules/safer-buffer": {
|
|
334
|
+
"version": "2.1.2",
|
|
335
|
+
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
|
336
|
+
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
|
337
|
+
"license": "MIT"
|
|
338
|
+
},
|
|
339
|
+
"node_modules/setprototypeof": {
|
|
340
|
+
"version": "1.2.0",
|
|
341
|
+
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
|
342
|
+
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
|
|
343
|
+
"license": "ISC"
|
|
344
|
+
},
|
|
345
|
+
"node_modules/statuses": {
|
|
346
|
+
"version": "2.0.2",
|
|
347
|
+
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
|
|
348
|
+
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
|
|
349
|
+
"license": "MIT",
|
|
350
|
+
"engines": {
|
|
351
|
+
"node": ">= 0.8"
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
"node_modules/toidentifier": {
|
|
355
|
+
"version": "1.0.1",
|
|
356
|
+
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
|
357
|
+
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
|
358
|
+
"license": "MIT",
|
|
359
|
+
"engines": {
|
|
360
|
+
"node": ">=0.6"
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
"node_modules/unpipe": {
|
|
364
|
+
"version": "1.0.0",
|
|
365
|
+
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
|
366
|
+
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
|
367
|
+
"license": "MIT",
|
|
368
|
+
"engines": {
|
|
369
|
+
"node": ">= 0.8"
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
"node_modules/zod": {
|
|
373
|
+
"version": "3.25.76",
|
|
374
|
+
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
|
|
375
|
+
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
|
376
|
+
"license": "MIT",
|
|
377
|
+
"funding": {
|
|
378
|
+
"url": "https://github.com/sponsors/colinhacks"
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
package/mcp/package.json
CHANGED
package/package.json
CHANGED
package/src/ai/client.ts
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Client - BYOK (Bring Your Own Key) support for multiple AI providers
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface AIProvider {
|
|
6
|
+
name: string;
|
|
7
|
+
endpoint?: string;
|
|
8
|
+
apiKey?: string;
|
|
9
|
+
model?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface AIResponse {
|
|
13
|
+
text: string;
|
|
14
|
+
model: string;
|
|
15
|
+
usage?: {
|
|
16
|
+
promptTokens: number;
|
|
17
|
+
completionTokens: number;
|
|
18
|
+
totalTokens: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Call OpenAI-compatible API
|
|
24
|
+
*/
|
|
25
|
+
async function callOpenAI(
|
|
26
|
+
provider: AIProvider,
|
|
27
|
+
prompt: string
|
|
28
|
+
): Promise<AIResponse> {
|
|
29
|
+
const endpoint = provider.endpoint || 'https://api.openai.com/v1/chat/completions';
|
|
30
|
+
const model = provider.model || 'gpt-4o-mini';
|
|
31
|
+
|
|
32
|
+
const response = await fetch(endpoint, {
|
|
33
|
+
method: 'POST',
|
|
34
|
+
headers: {
|
|
35
|
+
'Content-Type': 'application/json',
|
|
36
|
+
'Authorization': `Bearer ${provider.apiKey}`,
|
|
37
|
+
},
|
|
38
|
+
body: JSON.stringify({
|
|
39
|
+
model,
|
|
40
|
+
messages: [
|
|
41
|
+
{
|
|
42
|
+
role: 'system',
|
|
43
|
+
content: 'You are a security expert analyzing code vulnerabilities. Respond only with valid JSON.',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
role: 'user',
|
|
47
|
+
content: prompt,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
temperature: 0.3,
|
|
51
|
+
max_tokens: 500,
|
|
52
|
+
}),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
if (!response.ok) {
|
|
56
|
+
throw new Error(`OpenAI API error: ${response.status} ${response.statusText}`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const data: any = await response.json();
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
text: data.choices[0].message.content,
|
|
63
|
+
model: data.model,
|
|
64
|
+
usage: {
|
|
65
|
+
promptTokens: data.usage.prompt_tokens,
|
|
66
|
+
completionTokens: data.usage.completion_tokens,
|
|
67
|
+
totalTokens: data.usage.total_tokens,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Call Anthropic Claude API
|
|
74
|
+
*/
|
|
75
|
+
async function callClaude(
|
|
76
|
+
provider: AIProvider,
|
|
77
|
+
prompt: string
|
|
78
|
+
): Promise<AIResponse> {
|
|
79
|
+
const endpoint = provider.endpoint || 'https://api.anthropic.com/v1/messages';
|
|
80
|
+
const model = provider.model || 'claude-3-5-sonnet-20241022';
|
|
81
|
+
|
|
82
|
+
const response = await fetch(endpoint, {
|
|
83
|
+
method: 'POST',
|
|
84
|
+
headers: {
|
|
85
|
+
'Content-Type': 'application/json',
|
|
86
|
+
'x-api-key': provider.apiKey!,
|
|
87
|
+
'anthropic-version': '2023-06-01',
|
|
88
|
+
},
|
|
89
|
+
body: JSON.stringify({
|
|
90
|
+
model,
|
|
91
|
+
max_tokens: 500,
|
|
92
|
+
temperature: 0.3,
|
|
93
|
+
system: 'You are a security expert analyzing code vulnerabilities. Respond only with valid JSON.',
|
|
94
|
+
messages: [
|
|
95
|
+
{
|
|
96
|
+
role: 'user',
|
|
97
|
+
content: prompt,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
}),
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
if (!response.ok) {
|
|
104
|
+
throw new Error(`Claude API error: ${response.status} ${response.statusText}`);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const data: any = await response.json();
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
text: data.content[0].text,
|
|
111
|
+
model: data.model,
|
|
112
|
+
usage: {
|
|
113
|
+
promptTokens: data.usage.input_tokens,
|
|
114
|
+
completionTokens: data.usage.output_tokens,
|
|
115
|
+
totalTokens: data.usage.input_tokens + data.usage.output_tokens,
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Call Ollama (local)
|
|
122
|
+
*/
|
|
123
|
+
async function callOllama(
|
|
124
|
+
provider: AIProvider,
|
|
125
|
+
prompt: string
|
|
126
|
+
): Promise<AIResponse> {
|
|
127
|
+
const endpoint = provider.endpoint || 'http://localhost:11434/api/generate';
|
|
128
|
+
const model = provider.model || 'llama3.2';
|
|
129
|
+
|
|
130
|
+
const response = await fetch(endpoint, {
|
|
131
|
+
method: 'POST',
|
|
132
|
+
headers: {
|
|
133
|
+
'Content-Type': 'application/json',
|
|
134
|
+
},
|
|
135
|
+
body: JSON.stringify({
|
|
136
|
+
model,
|
|
137
|
+
prompt: `You are a security expert. ${prompt}`,
|
|
138
|
+
stream: false,
|
|
139
|
+
options: {
|
|
140
|
+
temperature: 0.3,
|
|
141
|
+
num_predict: 500,
|
|
142
|
+
},
|
|
143
|
+
}),
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
if (!response.ok) {
|
|
147
|
+
throw new Error(`Ollama API error: ${response.status} ${response.statusText}`);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const data: any = await response.json();
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
text: data.response,
|
|
154
|
+
model: data.model,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Main AI client - routes to correct provider
|
|
160
|
+
*/
|
|
161
|
+
export async function callAI(
|
|
162
|
+
provider: AIProvider,
|
|
163
|
+
prompt: string
|
|
164
|
+
): Promise<AIResponse> {
|
|
165
|
+
if (!provider.apiKey && provider.name !== 'ollama') {
|
|
166
|
+
throw new Error(`API key required for provider: ${provider.name}`);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
switch (provider.name.toLowerCase()) {
|
|
170
|
+
case 'openai':
|
|
171
|
+
return callOpenAI(provider, prompt);
|
|
172
|
+
|
|
173
|
+
case 'claude':
|
|
174
|
+
case 'anthropic':
|
|
175
|
+
return callClaude(provider, prompt);
|
|
176
|
+
|
|
177
|
+
case 'ollama':
|
|
178
|
+
return callOllama(provider, prompt);
|
|
179
|
+
|
|
180
|
+
default:
|
|
181
|
+
throw new Error(`Unsupported AI provider: ${provider.name}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Get AI provider from environment variables
|
|
187
|
+
*/
|
|
188
|
+
export function getAIProviderFromEnv(): AIProvider | null {
|
|
189
|
+
// Check for OpenAI
|
|
190
|
+
if (process.env.OPENAI_API_KEY) {
|
|
191
|
+
return {
|
|
192
|
+
name: 'openai',
|
|
193
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
194
|
+
model: process.env.OPENAI_MODEL || 'gpt-4o-mini',
|
|
195
|
+
endpoint: process.env.OPENAI_ENDPOINT,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Check for Claude
|
|
200
|
+
if (process.env.ANTHROPIC_API_KEY) {
|
|
201
|
+
return {
|
|
202
|
+
name: 'claude',
|
|
203
|
+
apiKey: process.env.ANTHROPIC_API_KEY,
|
|
204
|
+
model: process.env.ANTHROPIC_MODEL || 'claude-3-5-sonnet-20241022',
|
|
205
|
+
endpoint: process.env.ANTHROPIC_ENDPOINT,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Check for Ollama
|
|
210
|
+
if (process.env.OLLAMA_ENDPOINT || process.env.OLLAMA_HOST) {
|
|
211
|
+
return {
|
|
212
|
+
name: 'ollama',
|
|
213
|
+
model: process.env.OLLAMA_MODEL || 'llama3.2',
|
|
214
|
+
endpoint: process.env.OLLAMA_ENDPOINT || process.env.OLLAMA_HOST || 'http://localhost:11434/api/generate',
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return null;
|
|
219
|
+
}
|