Commit b437977
authored
🤖 feat: add backend support for soft-interrupts (#767)
Adds a `soft: boolean` option to `interruptStream()` that sets a pending
flag instead of immediately aborting. The stream manager checks this
flag at content boundaries (end of text blocks, tool results, reasoning
sections) and gracefully terminates at the next one.
This lays the groundwork for automatic context management—when the agent
approaches the context window limit, we can issue a soft interrupt to
let the current thought complete cleanly before triggering compaction.
This avoids cutting off mid-sentence or mid-tool-call, producing cleaner
conversation history for the compaction summary.
The frontend currently always uses hard interrupts; the soft interrupt
path is exercised only by tests for now. A following PR will use this
code.
I have an integration test to add back once the sendMessage integration
test suite is restored.....
---
_Generated with `mux`_1 parent df30cbc commit b437977
File tree
6 files changed
+121
-43
lines changed- src
- common/orpc/schemas
- node/services
6 files changed
+121
-43
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
189 | 194 | | |
190 | 195 | | |
191 | 196 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | | - | |
| 296 | + | |
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
409 | 412 | | |
410 | 413 | | |
411 | 414 | | |
412 | 415 | | |
413 | 416 | | |
414 | 417 | | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
419 | 422 | | |
420 | 423 | | |
421 | 424 | | |
422 | 425 | | |
423 | 426 | | |
424 | 427 | | |
425 | | - | |
| 428 | + | |
426 | 429 | | |
427 | 430 | | |
428 | 431 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
201 | | - | |
| 200 | + | |
202 | 201 | | |
203 | 202 | | |
204 | | - | |
205 | | - | |
206 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
210 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
211 | 214 | | |
212 | 215 | | |
213 | 216 | | |
| |||
1084 | 1087 | | |
1085 | 1088 | | |
1086 | 1089 | | |
1087 | | - | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
1088 | 1094 | | |
1089 | 1095 | | |
1090 | 1096 | | |
1091 | 1097 | | |
1092 | | - | |
| 1098 | + | |
1093 | 1099 | | |
1094 | 1100 | | |
1095 | 1101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
| |||
418 | 420 | | |
419 | 421 | | |
420 | 422 | | |
421 | | - | |
422 | 423 | | |
423 | 424 | | |
424 | 425 | | |
425 | 426 | | |
426 | 427 | | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
431 | 435 | | |
432 | | - | |
433 | | - | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
434 | 445 | | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
| 446 | + | |
| 447 | + | |
443 | 448 | | |
444 | | - | |
445 | | - | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
446 | 457 | | |
447 | 458 | | |
448 | 459 | | |
449 | 460 | | |
450 | 461 | | |
451 | 462 | | |
452 | 463 | | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
453 | 490 | | |
454 | 491 | | |
455 | 492 | | |
| |||
555 | 592 | | |
556 | 593 | | |
557 | 594 | | |
| 595 | + | |
558 | 596 | | |
559 | 597 | | |
560 | 598 | | |
| |||
718 | 756 | | |
719 | 757 | | |
720 | 758 | | |
| 759 | + | |
721 | 760 | | |
722 | 761 | | |
723 | 762 | | |
| |||
772 | 811 | | |
773 | 812 | | |
774 | 813 | | |
| 814 | + | |
775 | 815 | | |
776 | 816 | | |
777 | 817 | | |
| |||
808 | 848 | | |
809 | 849 | | |
810 | 850 | | |
| 851 | + | |
811 | 852 | | |
812 | 853 | | |
813 | 854 | | |
| |||
852 | 893 | | |
853 | 894 | | |
854 | 895 | | |
| 896 | + | |
855 | 897 | | |
856 | 898 | | |
857 | 899 | | |
| |||
869 | 911 | | |
870 | 912 | | |
871 | 913 | | |
| 914 | + | |
872 | 915 | | |
873 | 916 | | |
874 | 917 | | |
875 | | - | |
876 | | - | |
877 | | - | |
| 918 | + | |
| 919 | + | |
878 | 920 | | |
| 921 | + | |
879 | 922 | | |
880 | 923 | | |
881 | 924 | | |
| |||
1363 | 1406 | | |
1364 | 1407 | | |
1365 | 1408 | | |
| 1409 | + | |
| 1410 | + | |
1366 | 1411 | | |
1367 | | - | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
1368 | 1416 | | |
1369 | 1417 | | |
1370 | 1418 | | |
1371 | 1419 | | |
1372 | | - | |
1373 | | - | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
1374 | 1435 | | |
1375 | 1436 | | |
1376 | 1437 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
875 | 875 | | |
876 | 876 | | |
877 | 877 | | |
878 | | - | |
| 878 | + | |
879 | 879 | | |
880 | 880 | | |
881 | 881 | | |
882 | | - | |
| 882 | + | |
883 | 883 | | |
884 | 884 | | |
885 | 885 | | |
886 | 886 | | |
887 | 887 | | |
888 | | - | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
889 | 891 | | |
890 | 892 | | |
891 | 893 | | |
| |||
0 commit comments