Commit b22f7aa
committed
feat(ai): migrate AI features from BYOK to XTM One agents
The extension previously embedded its own LLM integration: users had to
bring their own API keys (OpenAI, Anthropic, Gemini, or a custom endpoint),
and the extension handled prompt engineering, JSON parsing of raw LLM
output, and model selection directly in the browser.
This was fragile, hard to iterate on (prompt changes required extension
releases), and put the burden of LLM configuration on end users.
With XTM One now hosting dedicated agents for each AI feature, the
extension becomes a thin client: it sends structured task payloads and
receives structured JSON responses. Prompt management, model routing,
and output parsing all move server-side.
All 7 AI features (description generation, scenario generation, full
scenario, atomic testing, email generation, entity discovery, relationship
resolution) now call `POST /api/v1/extension/execute-task` with an agent
slug. The `AIClient` class is reduced to a single `executeTask()` method
that serializes the request into a `content` field and identifies the
target agent via `XTM_ONE_AGENT_SLUGS`. Connection testing uses
`GET /api/v1/auth/me`.
- Deleted `AIProvider` type, `apiKey`, `model`, `customBaseUrl`,
`availableModels` from `AISettings` — replaced with `xtmOneUrl` and
`apiToken`
- Settings UI (`AITab.tsx`) replaced provider/model dropdowns with
XTM One URL + token fields; removed "Coming Soon" placeholder
- Background handlers (`ai-handlers.ts`, `ai-utils.ts`) simplified to
thin wrappers — removed prompt construction, JSON parsing, retry logic
- Removed unused `getMaxContentLength()` export from `ai-utils.ts`
- Removed dead `AIGenerationRequest`/`AIGenerationResponse` types
- `ai/prompts.ts` — hardcoded prompt templates now managed as XTM One
agent personas
- `ai/json-parser.ts` — JSON extraction from raw LLM output no longer
needed (XTM One returns structured data)
- Corresponding test files: `prompts.test.ts`, `json-parser.test.ts`
- Added `credentials: 'omit'` to OpenCTI client fetch calls
- Fixed `credentials: 'omit'` ordering in OpenAEV client — moved after
`...options` spread to prevent callers from overriding it
- Added user-friendly 401/404 error messages to OpenCTI and OpenAEV clients
- Fixed misleading JSDoc on `testConnection()` (claimed "execute-task"
but actually calls `/auth/me`)
All AI-gated UI surfaces now show "AI is not configured. Configure
XTM One in extension settings." when XTM One is not set up. Previously,
`ScenarioTypeSelector` and `ScenarioFormView` only showed a generic
"AI not available" with no guidance. Enterprise-gate message standardized
to "AI features require Enterprise Edition." across all views.1 parent c6fe25f commit b22f7aa
46 files changed
Lines changed: 2503 additions & 5839 deletions
File tree
- docs
- features
- src
- background
- handlers
- options
- components
- panel
- components/scenario
- types
- views
- popup
- components
- hooks
- tests
- e2e
- unit
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
| 214 | + | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
| 217 | + | |
| 218 | + | |
221 | 219 | | |
222 | 220 | | |
223 | 221 | | |
| |||
237 | 235 | | |
238 | 236 | | |
239 | 237 | | |
240 | | - | |
| 238 | + | |
241 | 239 | | |
242 | 240 | | |
243 | 241 | | |
| |||
829 | 827 | | |
830 | 828 | | |
831 | 829 | | |
832 | | - | |
| 830 | + | |
833 | 831 | | |
834 | | - | |
| 832 | + | |
835 | 833 | | |
836 | 834 | | |
837 | 835 | | |
| |||
873 | 871 | | |
874 | 872 | | |
875 | 873 | | |
876 | | - | |
877 | | - | |
| 874 | + | |
| 875 | + | |
878 | 876 | | |
879 | 877 | | |
880 | 878 | | |
| |||
915 | 913 | | |
916 | 914 | | |
917 | 915 | | |
918 | | - | |
| 916 | + | |
919 | 917 | | |
920 | | - | |
| 918 | + | |
921 | 919 | | |
922 | 920 | | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
927 | 925 | | |
928 | 926 | | |
929 | 927 | | |
930 | | - | |
931 | | - | |
932 | | - | |
933 | | - | |
934 | | - | |
935 | | - | |
936 | | - | |
937 | | - | |
938 | | - | |
939 | | - | |
940 | | - | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
941 | 931 | | |
942 | 932 | | |
943 | 933 | | |
944 | | - | |
945 | | - | |
946 | | - | |
947 | | - | |
948 | | - | |
949 | | - | |
950 | | - | |
951 | | - | |
952 | | - | |
953 | | - | |
954 | | - | |
955 | | - | |
956 | | - | |
957 | | - | |
958 | | - | |
959 | | - | |
960 | | - | |
961 | | - | |
962 | | - | |
963 | | - | |
964 | | - | |
965 | | - | |
966 | | - | |
967 | | - | |
968 | | - | |
969 | | - | |
970 | | - | |
971 | | - | |
972 | | - | |
973 | | - | |
974 | | - | |
975 | | - | |
976 | | - | |
977 | | - | |
978 | | - | |
979 | | - | |
980 | | - | |
981 | | - | |
982 | | - | |
983 | | - | |
984 | | - | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | | - | |
990 | | - | |
991 | | - | |
992 | | - | |
993 | | - | |
994 | | - | |
995 | | - | |
996 | | - | |
997 | | - | |
998 | | - | |
999 | | - | |
1000 | | - | |
1001 | | - | |
1002 | | - | |
1003 | | - | |
1004 | | - | |
1005 | | - | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
1009 | | - | |
1010 | | - | |
1011 | | - | |
1012 | | - | |
1013 | | - | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
1017 | 944 | | |
1018 | 945 | | |
1019 | 946 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
123 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
124 | 125 | | |
125 | | - | |
| 126 | + | |
126 | 127 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
133 | 132 | | |
134 | | - | |
| 133 | + | |
135 | 134 | | |
136 | | - | |
| 135 | + | |
137 | 136 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
142 | 140 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
| 141 | + | |
164 | 142 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
169 | 146 | | |
170 | 147 | | |
171 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
79 | | - | |
| 77 | + | |
80 | 78 | | |
81 | 79 | | |
82 | 80 | | |
| |||
103 | 101 | | |
104 | 102 | | |
105 | 103 | | |
106 | | - | |
| 104 | + | |
107 | 105 | | |
108 | 106 | | |
109 | 107 | | |
| |||
238 | 236 | | |
239 | 237 | | |
240 | 238 | | |
241 | | - | |
| 239 | + | |
242 | 240 | | |
243 | 241 | | |
244 | 242 | | |
245 | | - | |
246 | | - | |
247 | | - | |
| 243 | + | |
248 | 244 | | |
249 | 245 | | |
250 | 246 | | |
| |||
398 | 394 | | |
399 | 395 | | |
400 | 396 | | |
| 397 | + | |
| 398 | + | |
401 | 399 | | |
402 | 400 | | |
403 | 401 | | |
404 | 402 | | |
405 | | - | |
406 | | - | |
407 | | - | |
| 403 | + | |
| 404 | + | |
408 | 405 | | |
409 | 406 | | |
410 | | - | |
411 | | - | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
412 | 415 | | |
413 | | - | |
414 | | - | |
415 | | - | |
| 416 | + | |
| 417 | + | |
416 | 418 | | |
417 | 419 | | |
418 | 420 | | |
| |||
457 | 459 | | |
458 | 460 | | |
459 | 461 | | |
460 | | - | |
| 462 | + | |
461 | 463 | | |
462 | 464 | | |
463 | 465 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
299 | 296 | | |
300 | 297 | | |
301 | 298 | | |
| |||
0 commit comments