@linxiraos/pi-messenger 1.1.0 → 1.3.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.
- package/CHANGELOG.md +741 -676
- package/LICENSE +45 -0
- package/README.md +424 -424
- package/THIRD-PARTY-NOTICES.txt +22951 -0
- package/config-overlay.ts +175 -171
- package/config.ts +221 -209
- package/crew/agents/crew-plan-sync.md +66 -64
- package/crew/agents/crew-planner.md +173 -172
- package/crew/agents/crew-reviewer.md +58 -58
- package/crew/agents/crew-worker.md +130 -129
- package/crew/agents.ts +507 -434
- package/crew/handlers/coordination.ts +350 -332
- package/crew/handlers/plan.ts +988 -906
- package/crew/handlers/review.ts +354 -333
- package/crew/handlers/revise.ts +400 -376
- package/crew/handlers/status.ts +303 -295
- package/crew/handlers/sync.ts +237 -233
- package/crew/handlers/task.ts +820 -792
- package/crew/handlers/team.ts +294 -235
- package/crew/handlers/work.ts +467 -425
- package/crew/id-allocator.ts +30 -30
- package/crew/index.ts +297 -257
- package/crew/live-progress.ts +58 -58
- package/crew/lobby.ts +504 -473
- package/crew/prompt.ts +262 -252
- package/crew/registry.ts +114 -114
- package/crew/spawn.ts +135 -111
- package/crew/state-autonomous.ts +163 -164
- package/crew/state-planning.ts +264 -263
- package/crew/state.ts +20 -20
- package/crew/store.ts +646 -642
- package/crew/task-actions.ts +162 -131
- package/crew/team/store.ts +572 -479
- package/crew/team/subagent-roles.ts +105 -87
- package/crew/team/types.ts +50 -50
- package/crew/types.ts +194 -194
- package/crew/utils/artifacts.ts +57 -62
- package/crew/utils/config.ts +158 -156
- package/crew/utils/discover.ts +221 -219
- package/crew/utils/install.ts +94 -85
- package/crew/utils/migrations.ts +126 -0
- package/crew/utils/progress.ts +191 -187
- package/crew/utils/result.ts +16 -16
- package/crew/utils/risk-labels.ts +5 -7
- package/crew/utils/task-format.ts +14 -14
- package/crew/utils/team-roles.ts +44 -28
- package/crew/utils/truncate.ts +76 -79
- package/crew/utils/verdict.ts +55 -55
- package/editor-binary.ts +150 -0
- package/editor-command.ts +107 -0
- package/editor-target.ts +40 -0
- package/feed.ts +321 -268
- package/handlers.ts +1041 -1107
- package/index.ts +1314 -1206
- package/install.mjs +187 -189
- package/lib.ts +587 -467
- package/overlay-actions.ts +519 -511
- package/overlay-coordinator.ts +150 -150
- package/overlay-render.ts +770 -676
- package/overlay.ts +872 -830
- package/package.json +64 -60
- package/paths.ts +60 -0
- package/skills/pi-messenger-crew/SKILL.md +375 -347
- package/store.ts +1147 -1139
- package/teamagent-command.ts +321 -0
- package/vitest.config.ts +10 -10
package/overlay.ts
CHANGED
|
@@ -1,830 +1,872 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pi Messenger - Chat Overlay Component
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { Component, Focusable, TUI } from "@
|
|
6
|
-
import { matchesKey, truncateToWidth, visibleWidth } from "@
|
|
7
|
-
import type { Theme } from "@
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
import type
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
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
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Pi Messenger - Chat Overlay Component
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { Component, Focusable, TUI } from "@linxiraos/pi-tui";
|
|
6
|
+
import { matchesKey, truncateToWidth, visibleWidth } from "@linxiraos/pi-tui";
|
|
7
|
+
import type { Theme } from "@linxiraos/zeta";
|
|
8
|
+
import { extractFolder, formatDuration, type MessengerState, type Dirs } from "./lib.ts";
|
|
9
|
+
import * as crewStore from "./crew/store.ts";
|
|
10
|
+
import {
|
|
11
|
+
adjustConcurrency,
|
|
12
|
+
autonomousState,
|
|
13
|
+
isAutonomousForCwd,
|
|
14
|
+
isPlanningForCwd,
|
|
15
|
+
planningState,
|
|
16
|
+
} from "./crew/state.ts";
|
|
17
|
+
import { loadCrewConfig, cycleCoordinationLevel, setCoordinationOverride } from "./crew/utils/config.ts";
|
|
18
|
+
import { readFeedEvents, type FeedEvent, type FeedEventType } from "./feed.ts";
|
|
19
|
+
import type { Task } from "./crew/types.ts";
|
|
20
|
+
import {
|
|
21
|
+
renderStatusBar,
|
|
22
|
+
renderWorkersSection,
|
|
23
|
+
renderTaskList,
|
|
24
|
+
renderTaskSummary,
|
|
25
|
+
renderFeedSection,
|
|
26
|
+
renderAgentsRow,
|
|
27
|
+
renderLegend,
|
|
28
|
+
renderEmptyState,
|
|
29
|
+
renderPlanningState,
|
|
30
|
+
renderDetailView,
|
|
31
|
+
navigateTask,
|
|
32
|
+
} from "./overlay-render.ts";
|
|
33
|
+
import {
|
|
34
|
+
createCrewViewState,
|
|
35
|
+
handleConfirmInput,
|
|
36
|
+
handleBlockReasonInput,
|
|
37
|
+
handleMessageInput,
|
|
38
|
+
handleRevisePromptInput,
|
|
39
|
+
handleCrewKeyBinding,
|
|
40
|
+
setNotification,
|
|
41
|
+
type CrewViewState,
|
|
42
|
+
} from "./overlay-actions.ts";
|
|
43
|
+
import { getLiveWorkers, hasLiveWorkers, onLiveWorkersChanged } from "./crew/live-progress.ts";
|
|
44
|
+
import { loadConfig } from "./config.ts";
|
|
45
|
+
import { discoverCrewAgents } from "./crew/utils/discover.ts";
|
|
46
|
+
import { spawnSingleWorker, spawnWorkersForReadyTasks } from "./crew/spawn.ts";
|
|
47
|
+
import * as teamStore from "./crew/team/store.ts";
|
|
48
|
+
import { spawnLobbyWorker, removeLobbyWorkerByIndex, cleanupUnassignedAliveFiles } from "./crew/lobby.ts";
|
|
49
|
+
|
|
50
|
+
export interface OverlayCallbacks {
|
|
51
|
+
onBackground?: (snapshot: string) => void;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export class MessengerOverlay implements Component, Focusable {
|
|
55
|
+
get width(): number {
|
|
56
|
+
return Math.min(100, Math.max(40, process.stdout.columns ?? 90));
|
|
57
|
+
}
|
|
58
|
+
focused = false;
|
|
59
|
+
|
|
60
|
+
private crewViewState: CrewViewState = createCrewViewState();
|
|
61
|
+
private cwd: string;
|
|
62
|
+
private stuckThresholdMs: number;
|
|
63
|
+
private progressTimer: ReturnType<typeof setInterval> | null = null;
|
|
64
|
+
private planningTimer: ReturnType<typeof setInterval> | null = null;
|
|
65
|
+
private progressUnsubscribe: (() => void) | null = null;
|
|
66
|
+
private sawIncompleteWork = false;
|
|
67
|
+
private completionTimer: ReturnType<typeof setTimeout> | null = null;
|
|
68
|
+
private completionDismissed = false;
|
|
69
|
+
private wasPlanning: boolean;
|
|
70
|
+
private prevInProgressCount = 0;
|
|
71
|
+
|
|
72
|
+
constructor(
|
|
73
|
+
private tui: TUI,
|
|
74
|
+
private theme: Theme,
|
|
75
|
+
private state: MessengerState,
|
|
76
|
+
private dirs: Dirs,
|
|
77
|
+
private done: (snapshot?: string) => void,
|
|
78
|
+
private callbacks: OverlayCallbacks,
|
|
79
|
+
cwd: string,
|
|
80
|
+
) {
|
|
81
|
+
this.cwd = cwd;
|
|
82
|
+
const cfg = loadConfig(this.cwd);
|
|
83
|
+
this.stuckThresholdMs = cfg.stuckThreshold * 1000;
|
|
84
|
+
|
|
85
|
+
for (const key of this.state.unreadCounts.keys()) {
|
|
86
|
+
this.state.unreadCounts.set(key, 0);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
this.wasPlanning = isPlanningForCwd(this.cwd);
|
|
90
|
+
|
|
91
|
+
this.progressUnsubscribe = onLiveWorkersChanged(() => {
|
|
92
|
+
this.syncCrewRefreshTimers();
|
|
93
|
+
this.tui.requestRender();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
this.syncCrewRefreshTimers();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private hasPlan(): boolean {
|
|
100
|
+
return crewStore.hasPlan(this.cwd);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
private handleTaskStart(task: Task): void {
|
|
104
|
+
const config = loadCrewConfig(crewStore.getCrewDir(this.cwd));
|
|
105
|
+
if (config.dependencies !== "advisory") {
|
|
106
|
+
const unmet = task.depends_on.filter(depId => crewStore.getTask(this.cwd, depId)?.status !== "done");
|
|
107
|
+
if (unmet.length > 0) {
|
|
108
|
+
setNotification(this.crewViewState, this.tui, false, `Unmet deps: ${unmet.join(", ")}`);
|
|
109
|
+
this.tui.requestRender();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (teamStore.taskNeedsApproval(task)) {
|
|
114
|
+
const message = teamStore.taskNeedsRevision(task)
|
|
115
|
+
? `${task.id} needs revision`
|
|
116
|
+
: `${task.id} needs lead approval`;
|
|
117
|
+
setNotification(this.crewViewState, this.tui, false, message);
|
|
118
|
+
this.tui.requestRender();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const worker = spawnSingleWorker(this.cwd, task.id, this.state.model);
|
|
123
|
+
if (worker) {
|
|
124
|
+
setNotification(this.crewViewState, this.tui, true, `${worker.name} → ${task.id}`);
|
|
125
|
+
} else {
|
|
126
|
+
setNotification(this.crewViewState, this.tui, false, `Failed to spawn worker for ${task.id}`);
|
|
127
|
+
}
|
|
128
|
+
this.tui.requestRender();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
private spawnWorkerForReadyTask(task: Task, newConcurrency: number): void {
|
|
132
|
+
const worker = spawnSingleWorker(this.cwd, task.id, this.state.model);
|
|
133
|
+
if (!worker) {
|
|
134
|
+
const message = teamStore.taskNeedsRevision(task)
|
|
135
|
+
? `${task.id} needs revision`
|
|
136
|
+
: teamStore.taskNeedsApproval(task)
|
|
137
|
+
? `${task.id} needs lead approval`
|
|
138
|
+
: `Failed to spawn worker for ${task.id}`;
|
|
139
|
+
setNotification(this.crewViewState, this.tui, false, message);
|
|
140
|
+
this.tui.requestRender();
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
setNotification(this.crewViewState, this.tui, true, `${worker.name} → ${task.id} (${newConcurrency}w)`);
|
|
145
|
+
this.tui.requestRender();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
private isPlanningActiveForCurrentProject(): boolean {
|
|
149
|
+
return isPlanningForCwd(this.cwd);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
private checkAutoSpawnOnPlanComplete(planning: boolean, tasks: Task[]): void {
|
|
153
|
+
const wasPlanningBefore = this.wasPlanning;
|
|
154
|
+
this.wasPlanning = planning;
|
|
155
|
+
|
|
156
|
+
if (!wasPlanningBefore || planning) return;
|
|
157
|
+
|
|
158
|
+
const config = loadCrewConfig(crewStore.getCrewDir(this.cwd));
|
|
159
|
+
const readyTasks = crewStore.getReadyTasksFrom(tasks, { advisory: config.dependencies === "advisory" });
|
|
160
|
+
const startableTasks = readyTasks.filter(t => !teamStore.taskNeedsApproval(t));
|
|
161
|
+
if (startableTasks.length > 0) {
|
|
162
|
+
const target = Math.min(startableTasks.length, autonomousState.concurrency);
|
|
163
|
+
const { assigned } = spawnWorkersForReadyTasks(this.cwd, target, this.state.model);
|
|
164
|
+
if (assigned > 0) {
|
|
165
|
+
setNotification(
|
|
166
|
+
this.crewViewState,
|
|
167
|
+
this.tui,
|
|
168
|
+
true,
|
|
169
|
+
`Plan ready — ${assigned} worker${assigned > 1 ? "s" : ""} started`,
|
|
170
|
+
);
|
|
171
|
+
this.tui.requestRender();
|
|
172
|
+
}
|
|
173
|
+
} else if (readyTasks.length > 0) {
|
|
174
|
+
const rejected = readyTasks.filter(teamStore.taskNeedsRevision);
|
|
175
|
+
const pending = readyTasks.filter(teamStore.taskPendingApproval);
|
|
176
|
+
const message =
|
|
177
|
+
rejected.length > 0
|
|
178
|
+
? `Plan ready — ${rejected.length} task${rejected.length > 1 ? "s" : ""} need revision`
|
|
179
|
+
: `Plan ready — ${pending.length} task${pending.length > 1 ? "s" : ""} need lead approval`;
|
|
180
|
+
setNotification(this.crewViewState, this.tui, false, message);
|
|
181
|
+
this.tui.requestRender();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
cleanupUnassignedAliveFiles(this.cwd);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
private checkAutoRefillWorkers(tasks: Task[], hasPlan: boolean): void {
|
|
188
|
+
const inProgressCount = tasks.filter(t => t.status === "in_progress").length;
|
|
189
|
+
const prev = this.prevInProgressCount;
|
|
190
|
+
this.prevInProgressCount = inProgressCount;
|
|
191
|
+
|
|
192
|
+
if (inProgressCount >= prev || inProgressCount >= autonomousState.concurrency || !hasPlan) return;
|
|
193
|
+
|
|
194
|
+
const config = loadCrewConfig(crewStore.getCrewDir(this.cwd));
|
|
195
|
+
const readyTasks = crewStore.getReadyTasksFrom(tasks, { advisory: config.dependencies === "advisory" });
|
|
196
|
+
const startableTasks = readyTasks.filter(t => !teamStore.taskNeedsApproval(t));
|
|
197
|
+
if (startableTasks.length === 0) return;
|
|
198
|
+
|
|
199
|
+
const slots = autonomousState.concurrency - inProgressCount;
|
|
200
|
+
const target = Math.min(startableTasks.length, slots);
|
|
201
|
+
if (target <= 0) return;
|
|
202
|
+
|
|
203
|
+
const { assigned } = spawnWorkersForReadyTasks(this.cwd, target, this.state.model);
|
|
204
|
+
if (assigned > 0) {
|
|
205
|
+
setNotification(
|
|
206
|
+
this.crewViewState,
|
|
207
|
+
this.tui,
|
|
208
|
+
true,
|
|
209
|
+
`${assigned} worker${assigned > 1 ? "s" : ""} → ready tasks`,
|
|
210
|
+
);
|
|
211
|
+
this.tui.requestRender();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
private syncCrewRefreshTimers(): void {
|
|
216
|
+
if (hasLiveWorkers(this.cwd)) this.startProgressRefresh();
|
|
217
|
+
else this.stopProgressRefresh();
|
|
218
|
+
|
|
219
|
+
if (this.isPlanningActiveForCurrentProject()) this.startPlanningRefresh();
|
|
220
|
+
else this.stopPlanningRefresh();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
private startProgressRefresh(): void {
|
|
224
|
+
if (this.progressTimer) return;
|
|
225
|
+
this.progressTimer = setInterval(() => {
|
|
226
|
+
if (hasLiveWorkers(this.cwd)) {
|
|
227
|
+
this.tui.requestRender();
|
|
228
|
+
} else {
|
|
229
|
+
this.stopProgressRefresh();
|
|
230
|
+
}
|
|
231
|
+
}, 1000);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
private stopProgressRefresh(): void {
|
|
235
|
+
if (this.progressTimer) {
|
|
236
|
+
clearInterval(this.progressTimer);
|
|
237
|
+
this.progressTimer = null;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
private startPlanningRefresh(): void {
|
|
242
|
+
if (this.planningTimer) return;
|
|
243
|
+
this.planningTimer = setInterval(() => {
|
|
244
|
+
if (this.isPlanningActiveForCurrentProject()) {
|
|
245
|
+
this.tui.requestRender();
|
|
246
|
+
} else {
|
|
247
|
+
this.stopPlanningRefresh();
|
|
248
|
+
}
|
|
249
|
+
}, 15_000);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
private stopPlanningRefresh(): void {
|
|
253
|
+
if (this.planningTimer) {
|
|
254
|
+
clearInterval(this.planningTimer);
|
|
255
|
+
this.planningTimer = null;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
handleInput(data: string): void {
|
|
260
|
+
this.cancelCompletionTimer();
|
|
261
|
+
|
|
262
|
+
if (data === "\x14") {
|
|
263
|
+
this.done(this.generateSnapshot());
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (data === "\x02") {
|
|
268
|
+
this.callbacks.onBackground?.(this.generateSnapshot());
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (this.crewViewState.confirmAction) {
|
|
273
|
+
handleConfirmInput(data, this.crewViewState, this.cwd, this.state.agentName, this.tui);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (this.crewViewState.inputMode === "block-reason") {
|
|
278
|
+
const tasks = crewStore.getTasks(this.cwd);
|
|
279
|
+
const task = tasks[this.crewViewState.selectedTaskIndex];
|
|
280
|
+
handleBlockReasonInput(data, this.crewViewState, this.cwd, task, this.state.agentName, this.tui);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (this.crewViewState.inputMode === "message") {
|
|
285
|
+
handleMessageInput(data, this.crewViewState, this.state, this.dirs, this.cwd, this.tui);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (this.crewViewState.inputMode === "revise-prompt") {
|
|
290
|
+
const tasks = crewStore.getTasks(this.cwd);
|
|
291
|
+
const task = tasks[this.crewViewState.selectedTaskIndex];
|
|
292
|
+
handleRevisePromptInput(data, this.crewViewState, this.cwd, task, this.state.agentName, this.tui);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (matchesKey(data, "escape")) {
|
|
297
|
+
if (this.crewViewState.mode === "detail") {
|
|
298
|
+
this.crewViewState.mode = "list";
|
|
299
|
+
this.tui.requestRender();
|
|
300
|
+
} else {
|
|
301
|
+
this.done();
|
|
302
|
+
}
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if (data === "+" || matchesKey(data, "=") || matchesKey(data, "shift+=") || matchesKey(data, "-")) {
|
|
307
|
+
const delta = matchesKey(data, "-") ? -1 : 1;
|
|
308
|
+
const crewDir = crewStore.getCrewDir(this.cwd);
|
|
309
|
+
const config = loadCrewConfig(crewDir);
|
|
310
|
+
const prev = autonomousState.concurrency;
|
|
311
|
+
const next = adjustConcurrency(delta, config.concurrency.max);
|
|
312
|
+
if (prev === next) {
|
|
313
|
+
this.tui.requestRender();
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
if (next > prev) {
|
|
318
|
+
const readyTasks = crewStore.getReadyTasks(this.cwd, { advisory: config.dependencies === "advisory" });
|
|
319
|
+
if (readyTasks.length === 0) {
|
|
320
|
+
const worker = spawnLobbyWorker(this.cwd, undefined, this.state.model);
|
|
321
|
+
const label = worker ? `Lobby worker ${worker.name} spawned (${next}w)` : `Workers → ${next}`;
|
|
322
|
+
setNotification(this.crewViewState, this.tui, true, label);
|
|
323
|
+
} else {
|
|
324
|
+
this.spawnWorkerForReadyTask(readyTasks[0], next);
|
|
325
|
+
}
|
|
326
|
+
} else {
|
|
327
|
+
const killed = removeLobbyWorkerByIndex(this.cwd);
|
|
328
|
+
const label = killed ? `Lobby worker removed (${next}w)` : `Workers: ${prev} → ${next}`;
|
|
329
|
+
setNotification(this.crewViewState, this.tui, true, label);
|
|
330
|
+
}
|
|
331
|
+
this.tui.requestRender();
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (data === "@" || matchesKey(data, "m")) {
|
|
336
|
+
if (isPlanningForCwd(this.cwd)) {
|
|
337
|
+
setNotification(this.crewViewState, this.tui, false, "Chat unavailable during planning");
|
|
338
|
+
this.tui.requestRender();
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
this.crewViewState.inputMode = "message";
|
|
342
|
+
this.crewViewState.messageInput = data === "@" ? "@" : "";
|
|
343
|
+
this.tui.requestRender();
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (matchesKey(data, "f")) {
|
|
348
|
+
this.crewViewState.feedFocus = !this.crewViewState.feedFocus;
|
|
349
|
+
this.tui.requestRender();
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (matchesKey(data, "v")) {
|
|
354
|
+
const crewDir = crewStore.getCrewDir(this.cwd);
|
|
355
|
+
const config = loadCrewConfig(crewDir);
|
|
356
|
+
const next = cycleCoordinationLevel(config.coordination);
|
|
357
|
+
setCoordinationOverride(next);
|
|
358
|
+
setNotification(this.crewViewState, this.tui, true, `Coordination: ${next}`);
|
|
359
|
+
this.tui.requestRender();
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (matchesKey(data, "c") && this.isPlanningActiveForCurrentProject()) {
|
|
364
|
+
this.crewViewState.confirmAction = {
|
|
365
|
+
type: "cancel-planning",
|
|
366
|
+
taskId: "",
|
|
367
|
+
label: "planning",
|
|
368
|
+
};
|
|
369
|
+
this.tui.requestRender();
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
const tasks = crewStore.getTasks(this.cwd);
|
|
374
|
+
const task = tasks[this.crewViewState.selectedTaskIndex];
|
|
375
|
+
|
|
376
|
+
if (matchesKey(data, "right")) {
|
|
377
|
+
if (this.crewViewState.mode === "detail") {
|
|
378
|
+
navigateTask(this.crewViewState, 1, tasks.length);
|
|
379
|
+
this.crewViewState.detailScroll = 0;
|
|
380
|
+
this.crewViewState.detailAutoScroll = true;
|
|
381
|
+
this.tui.requestRender();
|
|
382
|
+
}
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
if (matchesKey(data, "left")) {
|
|
387
|
+
if (this.crewViewState.mode === "detail") {
|
|
388
|
+
navigateTask(this.crewViewState, -1, tasks.length);
|
|
389
|
+
this.crewViewState.detailScroll = 0;
|
|
390
|
+
this.crewViewState.detailAutoScroll = true;
|
|
391
|
+
this.tui.requestRender();
|
|
392
|
+
}
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
if (matchesKey(data, "up")) {
|
|
397
|
+
if (this.crewViewState.mode === "detail") {
|
|
398
|
+
this.crewViewState.detailScroll = Math.max(0, this.crewViewState.detailScroll - 1);
|
|
399
|
+
this.crewViewState.detailAutoScroll = false;
|
|
400
|
+
} else {
|
|
401
|
+
navigateTask(this.crewViewState, -1, tasks.length);
|
|
402
|
+
}
|
|
403
|
+
this.tui.requestRender();
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (matchesKey(data, "down")) {
|
|
408
|
+
if (this.crewViewState.mode === "detail") {
|
|
409
|
+
this.crewViewState.detailScroll++;
|
|
410
|
+
this.crewViewState.detailAutoScroll = false;
|
|
411
|
+
} else {
|
|
412
|
+
navigateTask(this.crewViewState, 1, tasks.length);
|
|
413
|
+
}
|
|
414
|
+
this.tui.requestRender();
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
if (matchesKey(data, "home")) {
|
|
419
|
+
this.crewViewState.selectedTaskIndex = 0;
|
|
420
|
+
this.crewViewState.scrollOffset = 0;
|
|
421
|
+
if (this.crewViewState.mode === "detail") {
|
|
422
|
+
this.crewViewState.detailScroll = 0;
|
|
423
|
+
this.crewViewState.detailAutoScroll = false;
|
|
424
|
+
}
|
|
425
|
+
this.tui.requestRender();
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
if (matchesKey(data, "end")) {
|
|
430
|
+
this.crewViewState.selectedTaskIndex = Math.max(0, tasks.length - 1);
|
|
431
|
+
if (this.crewViewState.mode === "detail") {
|
|
432
|
+
this.crewViewState.detailScroll = 0;
|
|
433
|
+
this.crewViewState.detailAutoScroll = true;
|
|
434
|
+
}
|
|
435
|
+
this.tui.requestRender();
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
if (matchesKey(data, "enter")) {
|
|
440
|
+
if (task && this.crewViewState.mode !== "detail") {
|
|
441
|
+
this.crewViewState.mode = "detail";
|
|
442
|
+
this.crewViewState.detailScroll = 0;
|
|
443
|
+
this.crewViewState.detailAutoScroll = true;
|
|
444
|
+
this.tui.requestRender();
|
|
445
|
+
}
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
if (this.crewViewState.mode === "detail") {
|
|
450
|
+
if (matchesKey(data, "[")) {
|
|
451
|
+
navigateTask(this.crewViewState, -1, tasks.length);
|
|
452
|
+
this.crewViewState.detailScroll = 0;
|
|
453
|
+
this.crewViewState.detailAutoScroll = true;
|
|
454
|
+
this.tui.requestRender();
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
if (matchesKey(data, "]")) {
|
|
458
|
+
navigateTask(this.crewViewState, 1, tasks.length);
|
|
459
|
+
this.crewViewState.detailScroll = 0;
|
|
460
|
+
this.crewViewState.detailAutoScroll = true;
|
|
461
|
+
this.tui.requestRender();
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (task) {
|
|
467
|
+
if (matchesKey(data, "s") && task.status === "todo" && !task.milestone) {
|
|
468
|
+
this.handleTaskStart(task);
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
handleCrewKeyBinding(data, task, this.crewViewState, this.cwd, this.state.agentName, this.tui);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
private snapshotIdleLabel(): string {
|
|
476
|
+
const last = this.state.activity.lastActivityAt || this.state.sessionStartedAt;
|
|
477
|
+
const ageMs = Math.max(0, Date.now() - new Date(last).getTime());
|
|
478
|
+
return `idle ${formatDuration(ageMs)}`;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
private formatTaskSnapshotLine(task: Task, liveTaskIds: Set<string>): string {
|
|
482
|
+
if (task.status === "done") {
|
|
483
|
+
return `${task.id} (${task.title})`;
|
|
484
|
+
}
|
|
485
|
+
if (task.status === "in_progress") {
|
|
486
|
+
const parts = [task.title];
|
|
487
|
+
if (task.assigned_to) parts.push(task.assigned_to);
|
|
488
|
+
if (liveTaskIds.has(task.id)) parts.push("live");
|
|
489
|
+
return `${task.id} (${parts.join(", ")})`;
|
|
490
|
+
}
|
|
491
|
+
if (task.status === "blocked") {
|
|
492
|
+
const reason = task.blocked_reason ? ` — ${task.blocked_reason}` : "";
|
|
493
|
+
return `${task.id} (${task.title}${reason})`;
|
|
494
|
+
}
|
|
495
|
+
if (task.depends_on.length > 0) {
|
|
496
|
+
return `${task.id} (${task.title}, deps: ${task.depends_on.join(" ")})`;
|
|
497
|
+
}
|
|
498
|
+
return `${task.id} (${task.title})`;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
private formatRecentFeedEvent(event: FeedEvent): string {
|
|
502
|
+
const time = new Date(event.ts).toLocaleTimeString("en-US", {
|
|
503
|
+
hour: "2-digit",
|
|
504
|
+
minute: "2-digit",
|
|
505
|
+
hour12: false,
|
|
506
|
+
});
|
|
507
|
+
if (event.type === "task.done") return `${event.agent} completed ${event.target ?? "task"} (${time})`;
|
|
508
|
+
if (event.type === "task.start") return `${event.agent} started ${event.target ?? "task"} (${time})`;
|
|
509
|
+
if (event.type === "message") {
|
|
510
|
+
const dir = event.target ? `→ ${event.target}: ` : "✦ ";
|
|
511
|
+
return event.preview
|
|
512
|
+
? `${event.agent} ${dir}${event.preview} (${time})`
|
|
513
|
+
: `${event.agent} ${dir.trim()} (${time})`;
|
|
514
|
+
}
|
|
515
|
+
if (event.target) return `${event.agent} ${event.type} ${event.target} (${time})`;
|
|
516
|
+
return `${event.agent} ${event.type} (${time})`;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
private generateSnapshot(): string {
|
|
520
|
+
const plan = crewStore.getPlan(this.cwd);
|
|
521
|
+
const tasks = crewStore.getTasks(this.cwd);
|
|
522
|
+
const liveWorkers = getLiveWorkers(this.cwd);
|
|
523
|
+
|
|
524
|
+
if (this.isPlanningActiveForCurrentProject() && tasks.length === 0) {
|
|
525
|
+
const updated = planningState.updatedAt
|
|
526
|
+
? formatDuration(Math.max(0, Date.now() - new Date(planningState.updatedAt).getTime()))
|
|
527
|
+
: "unknown";
|
|
528
|
+
return [
|
|
529
|
+
`Crew snapshot: planning in progress (pass ${planningState.pass}/${planningState.maxPasses}, ${planningState.phase}), ${autonomousState.concurrency}w concurrency`,
|
|
530
|
+
"",
|
|
531
|
+
`Planning: pass ${planningState.pass}/${planningState.maxPasses}, phase: ${planningState.phase}, updated ${updated} ago`,
|
|
532
|
+
"",
|
|
533
|
+
`Agents: You (${this.snapshotIdleLabel()})`,
|
|
534
|
+
].join("\n");
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
if (!plan) {
|
|
538
|
+
const discovered = discoverCrewAgents(this.cwd);
|
|
539
|
+
const configLine =
|
|
540
|
+
discovered.length === 0
|
|
541
|
+
? "Config: no crew agents discovered"
|
|
542
|
+
: `Config: ${discovered.map(agent => `${agent.name}${agent.model ? ` (${agent.model})` : ""}`).join(", ")}`;
|
|
543
|
+
|
|
544
|
+
return [
|
|
545
|
+
`Crew snapshot: no active plan, ${autonomousState.concurrency}w concurrency`,
|
|
546
|
+
"",
|
|
547
|
+
`Agents: You (${this.snapshotIdleLabel()})`,
|
|
548
|
+
"",
|
|
549
|
+
configLine,
|
|
550
|
+
].join("\n");
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
const config = loadCrewConfig(crewStore.getCrewDir(this.cwd));
|
|
554
|
+
const readyTasks = crewStore.getReadyTasks(this.cwd, { advisory: config.dependencies === "advisory" });
|
|
555
|
+
const readyIds = new Set(readyTasks.map(task => task.id));
|
|
556
|
+
const liveTaskIds = new Set(Array.from(liveWorkers.keys()));
|
|
557
|
+
const activeLines = Array.from(liveWorkers.values()).map(worker => {
|
|
558
|
+
const activity = worker.progress.currentTool
|
|
559
|
+
? `${worker.progress.currentTool}${worker.progress.currentToolArgs ? ` ${worker.progress.currentToolArgs}` : ""}`
|
|
560
|
+
: "thinking";
|
|
561
|
+
return `${worker.taskId} (${worker.agent}, ${activity}, ${formatDuration(Date.now() - worker.startedAt)})`;
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
const doneTasks = tasks.filter(task => task.status === "done");
|
|
565
|
+
const inProgressTasks = tasks.filter(task => task.status === "in_progress");
|
|
566
|
+
const blockedTasks = tasks.filter(task => task.status === "blocked");
|
|
567
|
+
const waitingTasks = tasks.filter(task => task.status === "todo" && !readyIds.has(task.id));
|
|
568
|
+
const recentEvents = readFeedEvents(this.cwd, 2);
|
|
569
|
+
const headerParts = [
|
|
570
|
+
`Crew snapshot: ${plan.completed_count}/${plan.task_count} tasks done`,
|
|
571
|
+
`${readyTasks.length} ready`,
|
|
572
|
+
`${autonomousState.concurrency}w`,
|
|
573
|
+
];
|
|
574
|
+
if (isAutonomousForCwd(this.cwd)) {
|
|
575
|
+
headerParts.push(`autonomous wave ${autonomousState.waveNumber}`);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
const lines = [
|
|
579
|
+
headerParts.join(", "),
|
|
580
|
+
"",
|
|
581
|
+
`Active: ${activeLines.length > 0 ? activeLines.join(", ") : "none"}`,
|
|
582
|
+
`Done: ${doneTasks.length > 0 ? doneTasks.map(task => this.formatTaskSnapshotLine(task, liveTaskIds)).join(", ") : "none"}`,
|
|
583
|
+
`In progress: ${inProgressTasks.length > 0 ? inProgressTasks.map(task => this.formatTaskSnapshotLine(task, liveTaskIds)).join(", ") : "none"}`,
|
|
584
|
+
`Ready: ${readyTasks.length > 0 ? readyTasks.map(task => this.formatTaskSnapshotLine(task, liveTaskIds)).join(", ") : "none"}`,
|
|
585
|
+
`Blocked: ${blockedTasks.length > 0 ? blockedTasks.map(task => this.formatTaskSnapshotLine(task, liveTaskIds)).join(", ") : "none"}`,
|
|
586
|
+
`Waiting: ${waitingTasks.length > 0 ? waitingTasks.map(task => this.formatTaskSnapshotLine(task, liveTaskIds)).join(", ") : "none"}`,
|
|
587
|
+
];
|
|
588
|
+
|
|
589
|
+
if (recentEvents.length > 0) {
|
|
590
|
+
lines.push("");
|
|
591
|
+
lines.push(`Recent: ${recentEvents.map(event => this.formatRecentFeedEvent(event)).join(", ")}`);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
return lines.join("\n");
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
render(_width: number): string[] {
|
|
598
|
+
const w = this.width;
|
|
599
|
+
const innerW = w - 2;
|
|
600
|
+
const sectionW = innerW - 2;
|
|
601
|
+
const border = (s: string) => this.theme.fg("dim", s);
|
|
602
|
+
const pad = (s: string, len: number) => s + " ".repeat(Math.max(0, len - visibleWidth(s)));
|
|
603
|
+
const sanitizeRowContent = (content: string) =>
|
|
604
|
+
content.replaceAll("\r", " ").replaceAll("\n", " ").replaceAll("\t", " ");
|
|
605
|
+
const row = (content: string) => {
|
|
606
|
+
const safe = truncateToWidth(sanitizeRowContent(content), sectionW);
|
|
607
|
+
return border("│") + pad(" " + safe, innerW) + border("│");
|
|
608
|
+
};
|
|
609
|
+
const emptyRow = () => border("│") + " ".repeat(innerW) + border("│");
|
|
610
|
+
const sectionSeparator = this.theme.fg("dim", "─".repeat(sectionW));
|
|
611
|
+
|
|
612
|
+
const tasks = crewStore.getTasks(this.cwd);
|
|
613
|
+
if (tasks.length === 0) {
|
|
614
|
+
this.crewViewState.selectedTaskIndex = 0;
|
|
615
|
+
if (this.crewViewState.mode === "detail") this.crewViewState.mode = "list";
|
|
616
|
+
} else {
|
|
617
|
+
this.crewViewState.selectedTaskIndex = Math.max(
|
|
618
|
+
0,
|
|
619
|
+
Math.min(this.crewViewState.selectedTaskIndex, tasks.length - 1),
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
const selectedTask = tasks[this.crewViewState.selectedTaskIndex] ?? null;
|
|
624
|
+
const hasPlan = this.hasPlan();
|
|
625
|
+
const planning = this.isPlanningActiveForCurrentProject();
|
|
626
|
+
this.checkAutoSpawnOnPlanComplete(planning, tasks);
|
|
627
|
+
this.checkAutoRefillWorkers(tasks, hasPlan);
|
|
628
|
+
|
|
629
|
+
const lines: string[] = [];
|
|
630
|
+
const titleContent = this.renderTitleContent();
|
|
631
|
+
const titleText = ` ${titleContent} `;
|
|
632
|
+
const titleLen = visibleWidth(titleContent) + 2;
|
|
633
|
+
const borderLen = Math.max(0, innerW - titleLen);
|
|
634
|
+
const leftBorder = Math.floor(borderLen / 2);
|
|
635
|
+
const rightBorder = borderLen - leftBorder;
|
|
636
|
+
|
|
637
|
+
lines.push(border("╭" + "─".repeat(leftBorder)) + titleText + border("─".repeat(rightBorder) + "╮"));
|
|
638
|
+
lines.push(row(renderStatusBar(this.theme, this.cwd, sectionW, tasks)));
|
|
639
|
+
lines.push(emptyRow());
|
|
640
|
+
|
|
641
|
+
const chromeLines = 6;
|
|
642
|
+
const termRows = process.stdout.rows ?? 24;
|
|
643
|
+
const contentHeight = Math.max(8, termRows - chromeLines);
|
|
644
|
+
|
|
645
|
+
const prevTs = this.crewViewState.lastSeenEventTs;
|
|
646
|
+
const allEvents = readFeedEvents(this.cwd, 20);
|
|
647
|
+
this.detectAndFlashEvents(allEvents, prevTs);
|
|
648
|
+
this.checkCompletion(tasks, planning);
|
|
649
|
+
|
|
650
|
+
let contentLines: string[];
|
|
651
|
+
if (this.crewViewState.mode === "detail" && selectedTask) {
|
|
652
|
+
contentLines = renderDetailView(this.cwd, selectedTask, sectionW, contentHeight, this.crewViewState);
|
|
653
|
+
} else {
|
|
654
|
+
const workersLimit = termRows <= 26 ? 2 : 5;
|
|
655
|
+
const hasWorkers = hasLiveWorkers(this.cwd);
|
|
656
|
+
|
|
657
|
+
let workerLines = renderWorkersSection(this.theme, this.cwd, sectionW, workersLimit);
|
|
658
|
+
const agentsLine = renderAgentsRow(
|
|
659
|
+
this.cwd,
|
|
660
|
+
sectionW,
|
|
661
|
+
this.state,
|
|
662
|
+
this.dirs,
|
|
663
|
+
this.stuckThresholdMs,
|
|
664
|
+
new Map([[this.cwd, tasks]]),
|
|
665
|
+
);
|
|
666
|
+
const agentsHeight = 2;
|
|
667
|
+
const workersHeight = () => (workerLines.length > 0 ? workerLines.length + 1 : 0);
|
|
668
|
+
const available = contentHeight - workersHeight() - agentsHeight;
|
|
669
|
+
|
|
670
|
+
const isFeedFocus = this.crewViewState.feedFocus;
|
|
671
|
+
let feedHeight: number;
|
|
672
|
+
let mainHeight: number;
|
|
673
|
+
|
|
674
|
+
if (!hasPlan && !planning) {
|
|
675
|
+
feedHeight = Math.min(allEvents.length, Math.max(2, Math.floor(available * 0.4)));
|
|
676
|
+
mainHeight = available - feedHeight - (feedHeight > 0 ? 1 : 0);
|
|
677
|
+
} else if (isFeedFocus) {
|
|
678
|
+
const summaryLines = 2;
|
|
679
|
+
mainHeight = summaryLines;
|
|
680
|
+
feedHeight = available - summaryLines - 1;
|
|
681
|
+
} else if (hasWorkers) {
|
|
682
|
+
feedHeight = Math.max(6, Math.floor(available * 0.7));
|
|
683
|
+
mainHeight = available - feedHeight - 1;
|
|
684
|
+
} else {
|
|
685
|
+
feedHeight = Math.max(4, Math.floor(available * 0.6));
|
|
686
|
+
mainHeight = available - feedHeight - 1;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
feedHeight = Math.max(0, feedHeight);
|
|
690
|
+
mainHeight = Math.max(2, mainHeight);
|
|
691
|
+
|
|
692
|
+
// Cap task list to actual content height — surplus goes to feed
|
|
693
|
+
const isTaskList = hasPlan && !isFeedFocus && tasks.length > 0;
|
|
694
|
+
if (isTaskList) {
|
|
695
|
+
const taskContentHeight = Math.max(2, tasks.length);
|
|
696
|
+
if (taskContentHeight < mainHeight) {
|
|
697
|
+
const surplus = mainHeight - taskContentHeight;
|
|
698
|
+
feedHeight += surplus;
|
|
699
|
+
mainHeight = taskContentHeight;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
const displayEvents = allEvents.slice(-feedHeight);
|
|
704
|
+
let feedLines = renderFeedSection(this.theme, displayEvents, sectionW, prevTs);
|
|
705
|
+
if (feedLines.length > feedHeight) feedLines = feedLines.slice(-feedHeight);
|
|
706
|
+
|
|
707
|
+
while (
|
|
708
|
+
workerLines.length > 0 &&
|
|
709
|
+
workersHeight() + mainHeight + (feedLines.length > 0 ? feedLines.length + 1 : 0) + agentsHeight >
|
|
710
|
+
contentHeight
|
|
711
|
+
) {
|
|
712
|
+
workerLines = workerLines.slice(0, workerLines.length - 1);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
let mainLines: string[];
|
|
716
|
+
if (!hasPlan && !planning) {
|
|
717
|
+
mainLines = renderEmptyState(this.theme, this.cwd, sectionW, mainHeight);
|
|
718
|
+
} else if (planning && tasks.length === 0) {
|
|
719
|
+
mainLines = renderPlanningState(this.theme, this.cwd, sectionW, mainHeight);
|
|
720
|
+
} else if (isFeedFocus && tasks.length > 0) {
|
|
721
|
+
mainLines = renderTaskSummary(this.theme, this.cwd, sectionW, mainHeight, tasks);
|
|
722
|
+
} else {
|
|
723
|
+
mainLines = renderTaskList(this.theme, this.cwd, sectionW, mainHeight, this.crewViewState, tasks);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
contentLines = [];
|
|
727
|
+
|
|
728
|
+
contentLines.push(agentsLine);
|
|
729
|
+
contentLines.push(sectionSeparator);
|
|
730
|
+
|
|
731
|
+
if (workerLines.length > 0) {
|
|
732
|
+
contentLines.push(...workerLines);
|
|
733
|
+
contentLines.push(sectionSeparator);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
contentLines.push(...mainLines);
|
|
737
|
+
|
|
738
|
+
if (feedLines.length > 0) {
|
|
739
|
+
contentLines.push(sectionSeparator);
|
|
740
|
+
contentLines.push(...feedLines);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
if (contentLines.length > contentHeight) {
|
|
744
|
+
contentLines = contentLines.slice(0, contentHeight);
|
|
745
|
+
}
|
|
746
|
+
while (contentLines.length < contentHeight) {
|
|
747
|
+
contentLines.push("");
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
for (const line of contentLines) {
|
|
752
|
+
lines.push(row(line));
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
lines.push(border("├" + "─".repeat(innerW) + "┤"));
|
|
756
|
+
lines.push(row(renderLegend(this.theme, this.cwd, sectionW, this.crewViewState, selectedTask)));
|
|
757
|
+
lines.push(border("╰" + "─".repeat(innerW) + "╯"));
|
|
758
|
+
|
|
759
|
+
if (allEvents.length > 0) {
|
|
760
|
+
this.crewViewState.lastSeenEventTs = allEvents[allEvents.length - 1].ts;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
return lines;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
private static readonly SIGNIFICANT_EVENTS = new Set<FeedEventType>([
|
|
767
|
+
"task.done",
|
|
768
|
+
"task.block",
|
|
769
|
+
"task.start",
|
|
770
|
+
"message",
|
|
771
|
+
"plan.done",
|
|
772
|
+
"plan.failed",
|
|
773
|
+
"task.revise",
|
|
774
|
+
"task.revise-tree",
|
|
775
|
+
]);
|
|
776
|
+
|
|
777
|
+
private detectAndFlashEvents(events: FeedEvent[], prevTs: string | null): void {
|
|
778
|
+
if (prevTs === null) return;
|
|
779
|
+
const newEvents = events.filter(e => e.ts > prevTs);
|
|
780
|
+
if (newEvents.length === 0) return;
|
|
781
|
+
|
|
782
|
+
const significant = newEvents.filter(e => MessengerOverlay.SIGNIFICANT_EVENTS.has(e.type));
|
|
783
|
+
if (significant.length === 0) return;
|
|
784
|
+
|
|
785
|
+
const last = significant[significant.length - 1];
|
|
786
|
+
const sameType = significant.filter(e => e.type === last.type);
|
|
787
|
+
|
|
788
|
+
let message: string;
|
|
789
|
+
if (sameType.length > 1) {
|
|
790
|
+
const label =
|
|
791
|
+
last.type === "task.done"
|
|
792
|
+
? `${sameType.length} tasks completed`
|
|
793
|
+
: last.type === "task.start"
|
|
794
|
+
? `${sameType.length} tasks started`
|
|
795
|
+
: last.type === "task.block"
|
|
796
|
+
? `${sameType.length} tasks blocked`
|
|
797
|
+
: last.type === "message"
|
|
798
|
+
? `${sameType.length} new messages`
|
|
799
|
+
: `${sameType.length} ${last.type} events`;
|
|
800
|
+
message = label;
|
|
801
|
+
} else {
|
|
802
|
+
const target = last.target ? ` ${last.target}` : "";
|
|
803
|
+
const preview = last.preview ? ` — ${last.preview.slice(0, 40)}` : "";
|
|
804
|
+
message =
|
|
805
|
+
last.type === "task.done"
|
|
806
|
+
? `${last.agent} completed${target}`
|
|
807
|
+
: last.type === "task.start"
|
|
808
|
+
? `${last.agent} started${target}`
|
|
809
|
+
: last.type === "task.block"
|
|
810
|
+
? `${last.agent} blocked${target}${preview}`
|
|
811
|
+
: last.type === "message"
|
|
812
|
+
? `${last.agent}${preview || " sent a message"}`
|
|
813
|
+
: last.type === "plan.done"
|
|
814
|
+
? "Planning completed"
|
|
815
|
+
: last.type === "plan.failed"
|
|
816
|
+
? "Planning failed"
|
|
817
|
+
: `${last.agent} ${last.type}${target}`;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
setNotification(this.crewViewState, this.tui, true, message);
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
private checkCompletion(tasks: Task[], planning: boolean): void {
|
|
824
|
+
const allDone = tasks.length > 0 && tasks.every(t => t.status === "done");
|
|
825
|
+
const isIdle = !hasLiveWorkers(this.cwd) && !isAutonomousForCwd(this.cwd) && !planning;
|
|
826
|
+
|
|
827
|
+
if (!allDone) {
|
|
828
|
+
this.sawIncompleteWork = true;
|
|
829
|
+
this.cancelCompletionTimer();
|
|
830
|
+
this.completionDismissed = false;
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
if (isIdle && this.sawIncompleteWork && !this.completionTimer && !this.completionDismissed) {
|
|
835
|
+
setNotification(this.crewViewState, this.tui, true, "All tasks complete! Closing in 3s...");
|
|
836
|
+
this.completionTimer = setTimeout(() => {
|
|
837
|
+
this.completionTimer = null;
|
|
838
|
+
this.done(this.generateSnapshot());
|
|
839
|
+
}, 3000);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
private cancelCompletionTimer(): void {
|
|
844
|
+
if (this.completionTimer) {
|
|
845
|
+
clearTimeout(this.completionTimer);
|
|
846
|
+
this.completionTimer = null;
|
|
847
|
+
this.completionDismissed = true;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
private renderTitleContent(): string {
|
|
852
|
+
const label = this.theme.fg("accent", "Messenger");
|
|
853
|
+
const folder = this.theme.fg("dim", extractFolder(this.cwd));
|
|
854
|
+
return `${label} ─ ${folder}`;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
invalidate(): void {
|
|
858
|
+
// No cached state
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
dispose(): void {
|
|
862
|
+
this.stopProgressRefresh();
|
|
863
|
+
this.stopPlanningRefresh();
|
|
864
|
+
this.cancelCompletionTimer();
|
|
865
|
+
if (this.crewViewState.notificationTimer) {
|
|
866
|
+
clearTimeout(this.crewViewState.notificationTimer);
|
|
867
|
+
this.crewViewState.notificationTimer = null;
|
|
868
|
+
}
|
|
869
|
+
this.progressUnsubscribe?.();
|
|
870
|
+
this.progressUnsubscribe = null;
|
|
871
|
+
}
|
|
872
|
+
}
|