Commit baeb59a
authored
feat: add experimental global AI assistant option (#4567)
* feat: add global chat streaming endpoint and routing
- Add global_chat_stream/2 to ApolloClient for /services/global_chat/stream
- Add global_chat?/1 and process_global_message/2 to MessageProcessor
- Route to global_chat when use_global_assistant is in session meta
- Pass use_global_assistant and page through channel message_options
- Add experimental_features_enabled to workflow channel get_context
* feat: add query_global_stream and build_global_message
- Add query_global_stream/3 using process_stream with build_global_message
- build_global_message extracts code from attachments (job_code or workflow_yaml)
- Context-aware: on job step prefers job_code, on overview prefers workflow_yaml
- Resolves job_id from job_key in attachment by matching against workflow jobs
* feat: add experimental features flag to frontend session context
- Add experimental_features_enabled to SessionContextResponseSchema
- Map to experimentalFeaturesEnabled in SessionContextStore
- Add useExperimentalFeaturesEnabled hook
- Add use_global_assistant and page to MessageOptions type
* feat: add global assistant checkbox and UI wiring
- Add Global assistant (experimental) checkbox to ChatInput with
localStorage persistence and onGlobalAssistantChange callback
- Pass use_global_assistant and page through AIChannelRegistry buildJoinParams
- Wire checkbox through AIAssistantPanel with showGlobalAssistantOption,
isGlobalAssistantActive, and onGlobalAssistantChange props
- AIAssistantPanelWrapper includes workflow YAML and page when global
assistant is active, derives page from workflow/job context
- Badge shows "Global (experimental)" in amber when active
* chore: add changelog entry for global AI assistant (#4532)
* test: add experimental_features_enabled to session context test fixture
The Zod schema adds a default value for the new optional field,
so the parsed output includes it. Update the test fixture to match.
* refactor: extract_global_code_and_job to reduce cyclomatic complexity
Split build_global_message into smaller functions to satisfy
credo's complexity threshold.
* test: add coverage for global chat integration
- ApolloClient: global_chat_stream payload, nil filtering, error handling
- AiAssistant: query_global_stream SSE processing, job_code vs workflow_yaml
extraction, job resolution from job_key, error handling
- MessageProcessor: global_chat routing when use_global_assistant is set
- AiAssistantChannel: session options and message options with global assistant
- WorkflowChannel: experimental_features_enabled in get_context
* test: add coverage for edge cases in build_global_message
Cover workflow_yaml fallback on overview pages, nil job_key handling
in resolve_job_from_key, and non-list attachments.
* test: cover resolve_job_from_key with nil workflow_id
* test: cover normalize_job_name catch-all with non-string job_key
* feat: use job_key from global chat to identify job code messages
When the global chat routes to job_code_agent and the job can't be
resolved to a DB record, store the job_key in message meta as
from_global_job_code so the frontend can render "Generated Job Code"
with a diff view instead of a generic workflow card.1 parent bf0687f commit baeb59a
File tree
20 files changed
+1268
-12
lines changed- assets
- js/collaborative-editor
- components
- hooks
- lib
- stores
- types
- test/collaborative-editor/types
- lib
- lightning_web/channels
- lightning
- ai_assistant
- test
- lightning_web/channels
- lightning
- ai_assistant
20 files changed
+1268
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
Lines changed: 22 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
69 | 75 | | |
70 | 76 | | |
71 | 77 | | |
| 78 | + | |
72 | 79 | | |
73 | 80 | | |
74 | 81 | | |
| |||
103 | 110 | | |
104 | 111 | | |
105 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
106 | 116 | | |
107 | 117 | | |
108 | 118 | | |
| |||
267 | 277 | | |
268 | 278 | | |
269 | 279 | | |
270 | | - | |
271 | | - | |
272 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
273 | 285 | | |
274 | 286 | | |
275 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
276 | 292 | | |
277 | 293 | | |
278 | 294 | | |
| |||
433 | 449 | | |
434 | 450 | | |
435 | 451 | | |
| 452 | + | |
| 453 | + | |
436 | 454 | | |
437 | 455 | | |
438 | 456 | | |
| |||
Lines changed: 46 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
| 137 | + | |
| 138 | + | |
136 | 139 | | |
137 | 140 | | |
138 | 141 | | |
| |||
309 | 312 | | |
310 | 313 | | |
311 | 314 | | |
| 315 | + | |
312 | 316 | | |
313 | 317 | | |
314 | 318 | | |
| |||
355 | 359 | | |
356 | 360 | | |
357 | 361 | | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
358 | 365 | | |
359 | 366 | | |
360 | | - | |
361 | | - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
362 | 372 | | |
363 | 373 | | |
364 | 374 | | |
| |||
372 | 382 | | |
373 | 383 | | |
374 | 384 | | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
375 | 397 | | |
376 | 398 | | |
377 | 399 | | |
| |||
398 | 420 | | |
399 | 421 | | |
400 | 422 | | |
| 423 | + | |
| 424 | + | |
401 | 425 | | |
402 | 426 | | |
403 | 427 | | |
404 | 428 | | |
405 | 429 | | |
406 | | - | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
407 | 434 | | |
408 | 435 | | |
409 | 436 | | |
| |||
418 | 445 | | |
419 | 446 | | |
420 | 447 | | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
421 | 457 | | |
422 | 458 | | |
423 | 459 | | |
| |||
449 | 485 | | |
450 | 486 | | |
451 | 487 | | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
452 | 492 | | |
453 | 493 | | |
454 | 494 | | |
| |||
642 | 682 | | |
643 | 683 | | |
644 | 684 | | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
645 | 688 | | |
646 | 689 | | |
647 | 690 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
16 | 20 | | |
17 | 21 | | |
18 | 22 | | |
| |||
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| |||
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
| 54 | + | |
| 55 | + | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
| |||
96 | 103 | | |
97 | 104 | | |
98 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
99 | 117 | | |
100 | 118 | | |
101 | 119 | | |
| |||
143 | 161 | | |
144 | 162 | | |
145 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
146 | 172 | | |
147 | 173 | | |
148 | 174 | | |
| |||
181 | 207 | | |
182 | 208 | | |
183 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
184 | 227 | | |
185 | 228 | | |
186 | 229 | | |
| |||
216 | 259 | | |
217 | 260 | | |
218 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
219 | 266 | | |
220 | 267 | | |
221 | 268 | | |
| |||
422 | 469 | | |
423 | 470 | | |
424 | 471 | | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
425 | 497 | | |
426 | 498 | | |
427 | 499 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
308 | 324 | | |
309 | 325 | | |
310 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
915 | 915 | | |
916 | 916 | | |
917 | 917 | | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
918 | 926 | | |
919 | 927 | | |
920 | 928 | | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| |||
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
| 193 | + | |
| 194 | + | |
192 | 195 | | |
193 | 196 | | |
194 | 197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
219 | 222 | | |
220 | 223 | | |
221 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
| |||
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
| 131 | + | |
130 | 132 | | |
131 | 133 | | |
132 | 134 | | |
| |||
0 commit comments