@bolloon/bolloon-agent 0.1.13 → 0.1.15

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.
Files changed (47) hide show
  1. package/dist/agents/pi-sdk.js +222 -9
  2. package/dist/agents/shell-guard.js +354 -0
  3. package/dist/agents/shell-tool.js +83 -0
  4. package/dist/agents/skill-loader.js +174 -0
  5. package/dist/bollharness-integration/context-chain-router.js +3 -3
  6. package/dist/bollharness-integration/context-router.js +1 -1
  7. package/dist/heartbeat/Watchdog.js +7 -5
  8. package/dist/heartbeat/index.js +1 -0
  9. package/dist/heartbeat/self-improve-bus.js +85 -0
  10. package/dist/pi-ecosystem-judgment/index.js +1 -2
  11. package/dist/utils/auto-update.js +44 -12
  12. package/dist/web/client.js +841 -103
  13. package/dist/web/index.html +88 -8
  14. package/dist/web/style.css +506 -9
  15. package/package.json +2 -2
  16. package/scripts/build-cli.js +11 -1
  17. package/src/agents/pi-sdk.ts +230 -10
  18. package/src/agents/shell-guard.ts +417 -0
  19. package/src/agents/shell-tool.ts +103 -0
  20. package/src/agents/skill-loader.ts +202 -0
  21. package/src/bollharness-integration/context-chain-router.ts +3 -3
  22. package/src/bollharness-integration/context-router.ts +1 -1
  23. package/src/heartbeat/Watchdog.ts +7 -5
  24. package/src/heartbeat/index.ts +1 -0
  25. package/src/heartbeat/self-improve-bus.ts +110 -0
  26. package/src/types.d.ts +12 -0
  27. package/src/utils/auto-update.ts +45 -14
  28. package/src/web/client.js +841 -103
  29. package/src/web/index.html +88 -8
  30. package/src/web/server.ts +427 -101
  31. package/src/web/style.css +506 -9
  32. package/dist/bollharness-integration/bollharness-integration/context-router-judgment.d.ts +0 -48
  33. package/dist/bollharness-integration/bollharness-integration/context-router-judgment.js +0 -261
  34. package/dist/bollharness-integration/bollharness-integration/context-router.d.ts +0 -110
  35. package/dist/bollharness-integration/bollharness-integration/context-router.js +0 -542
  36. package/dist/bollharness-integration/bollharness-integration/gate-state-machine.d.ts +0 -87
  37. package/dist/bollharness-integration/bollharness-integration/gate-state-machine.js +0 -231
  38. package/dist/bollharness-integration/bollharness-integration/gate-transition-hooks.d.ts +0 -30
  39. package/dist/bollharness-integration/bollharness-integration/gate-transition-hooks.js +0 -91
  40. package/dist/bollharness-integration/bollharness-integration/guard-checker.d.ts +0 -105
  41. package/dist/bollharness-integration/bollharness-integration/guard-checker.js +0 -353
  42. package/dist/bollharness-integration/bollharness-integration/index.d.ts +0 -66
  43. package/dist/bollharness-integration/bollharness-integration/index.js +0 -32
  44. package/dist/bollharness-integration/bollharness-integration/integration.d.ts +0 -219
  45. package/dist/bollharness-integration/bollharness-integration/integration.js +0 -420
  46. package/dist/bollharness-integration/bollharness-integration/skill-adapter.d.ts +0 -151
  47. package/dist/bollharness-integration/bollharness-integration/skill-adapter.js +0 -518
package/src/web/style.css CHANGED
@@ -261,18 +261,37 @@ body {
261
261
 
262
262
  /* Sidebar Section */
263
263
  .sidebar-section {
264
- flex: 1;
264
+ flex: 1 1 0;
265
+ min-height: 0; /* 关键: flex 子项 min-height 默认 auto, 会撑破 overflow */
265
266
  display: flex;
266
267
  flex-direction: column;
267
268
  overflow: hidden;
268
269
  padding: 16px;
270
+ position: relative;
269
271
  }
270
-
271
272
  .section-header {
272
273
  display: flex;
273
274
  align-items: center;
274
275
  justify-content: space-between;
275
276
  margin-bottom: 12px;
277
+ /* sticky 头部: 长列表滚动时, 智能体标题始终可见, 防止用户失去方向感 */
278
+ position: sticky;
279
+ top: 0;
280
+ z-index: 2;
281
+ padding-bottom: 6px;
282
+ /* 用伪元素做模糊底色, 让滚动的内容在它下面淡出而不是硬切 */
283
+ }
284
+
285
+ .section-header::after {
286
+ content: '';
287
+ position: absolute;
288
+ left: -16px;
289
+ right: -16px;
290
+ bottom: -6px;
291
+ height: 18px;
292
+ background: linear-gradient(to bottom, var(--bg-sidebar), transparent);
293
+ pointer-events: none;
294
+ z-index: -1;
276
295
  }
277
296
 
278
297
  .section-title {
@@ -355,13 +374,25 @@ body {
355
374
  list-style: none;
356
375
  flex: 1;
357
376
  overflow-y: auto;
358
- display: flex;
359
- flex-direction: column;
360
- gap: 4px;
377
+ overflow-x: hidden;
378
+ /* 流畅的上下滑动: iOS 弹性滚动 + 桌面惯性滚动 + 边界不外溢 */
379
+ -webkit-overflow-scrolling: touch;
380
+ overscroll-behavior: contain;
381
+ scroll-behavior: smooth;
382
+ /* contain 让长列表滚动时不影响外层布局, 减少 reflow */
383
+ contain: strict;
384
+ /* 重要: gap 在 overflow 容器里会触发滚动跳帧, 用 margin 替代 */
385
+ display: block;
386
+ padding: 0;
387
+ margin: 0;
388
+ }
389
+
390
+ .channel-list > .agent-group + .agent-group {
391
+ margin-top: 4px;
361
392
  }
362
393
 
363
394
  .channel-list::-webkit-scrollbar {
364
- width: 4px;
395
+ width: 6px;
365
396
  }
366
397
 
367
398
  .channel-list::-webkit-scrollbar-track {
@@ -370,7 +401,16 @@ body {
370
401
 
371
402
  .channel-list::-webkit-scrollbar-thumb {
372
403
  background: var(--border);
373
- border-radius: 2px;
404
+ border-radius: 3px;
405
+ /* 滚动条 hover 才出现, 默认隐藏, 减少视觉干扰 */
406
+ opacity: 0;
407
+ transition: opacity 0.15s ease;
408
+ }
409
+
410
+ .channel-list:hover::-webkit-scrollbar-thumb,
411
+ .channel-list:focus-within::-webkit-scrollbar-thumb,
412
+ .channel-list.is-scrolling::-webkit-scrollbar-thumb {
413
+ opacity: 1;
374
414
  }
375
415
 
376
416
  .channel-item {
@@ -424,6 +464,47 @@ body {
424
464
  text-overflow: ellipsis;
425
465
  }
426
466
 
467
+ .agent-session-count {
468
+ display: inline-flex;
469
+ align-items: center;
470
+ justify-content: center;
471
+ min-width: 18px;
472
+ height: 18px;
473
+ padding: 0 5px;
474
+ margin-left: 4px;
475
+ border-radius: 9px;
476
+ background: var(--bg);
477
+ border: 1px solid var(--border);
478
+ color: var(--text-muted);
479
+ font-size: 11px;
480
+ font-weight: 500;
481
+ flex-shrink: 0;
482
+ }
483
+
484
+ .agent-current-session {
485
+ flex: 0 1 auto;
486
+ margin-left: 4px;
487
+ padding: 0 6px;
488
+ font-size: 11px;
489
+ color: var(--text-muted);
490
+ background: var(--bg);
491
+ border: 1px solid var(--border);
492
+ border-radius: 9px;
493
+ height: 18px;
494
+ line-height: 16px;
495
+ max-width: 100px;
496
+ white-space: nowrap;
497
+ overflow: hidden;
498
+ text-overflow: ellipsis;
499
+ flex-shrink: 1;
500
+ }
501
+
502
+ .agent-row.active .agent-current-session {
503
+ color: var(--accent);
504
+ border-color: var(--border-light);
505
+ background: var(--bg-hover);
506
+ }
507
+
427
508
  .channel-delete {
428
509
  width: 24px;
429
510
  height: 24px;
@@ -435,12 +516,13 @@ body {
435
516
  display: flex;
436
517
  align-items: center;
437
518
  justify-content: center;
438
- opacity: 0;
519
+ opacity: 0.45;
439
520
  transition: var(--transition);
440
521
  font-size: 16px;
441
522
  }
442
523
 
443
- .channel-item:hover .channel-delete {
524
+ .channel-item:hover .channel-delete,
525
+ .agent-row:hover .channel-delete {
444
526
  opacity: 1;
445
527
  }
446
528
 
@@ -449,6 +531,172 @@ body {
449
531
  color: var(--error);
450
532
  }
451
533
 
534
+ /* Agent group (formerly channel-item — kept classname for back-compat) */
535
+ .agent-group {
536
+ display: flex;
537
+ flex-direction: column;
538
+ border-radius: var(--radius-sm);
539
+ overflow: hidden;
540
+ }
541
+
542
+ .agent-row {
543
+ display: flex;
544
+ align-items: center;
545
+ padding: 10px 12px;
546
+ border-radius: var(--radius-sm);
547
+ cursor: pointer;
548
+ transition: var(--transition);
549
+ gap: 10px;
550
+ }
551
+
552
+ .agent-row:hover {
553
+ background: var(--bg-hover);
554
+ }
555
+
556
+ .agent-row.active {
557
+ background: var(--bg-active);
558
+ border: 1px solid var(--border-light);
559
+ }
560
+
561
+ .agent-row.active .channel-name {
562
+ color: var(--accent);
563
+ font-weight: 500;
564
+ }
565
+
566
+ .agent-caret {
567
+ width: 14px;
568
+ height: 14px;
569
+ color: var(--text-muted);
570
+ transition: transform 0.18s ease;
571
+ flex-shrink: 0;
572
+ }
573
+
574
+ .agent-group.expanded .agent-caret {
575
+ transform: rotate(90deg);
576
+ }
577
+
578
+ .agent-new-session {
579
+ width: 22px;
580
+ height: 22px;
581
+ border-radius: 5px;
582
+ background: transparent;
583
+ border: none;
584
+ color: var(--text-muted);
585
+ cursor: pointer;
586
+ display: flex;
587
+ align-items: center;
588
+ justify-content: center;
589
+ opacity: 0;
590
+ transition: var(--transition);
591
+ flex-shrink: 0;
592
+ }
593
+
594
+ .agent-row:hover .agent-new-session {
595
+ opacity: 1;
596
+ }
597
+
598
+ .agent-new-session:hover {
599
+ background: var(--accent);
600
+ color: var(--bg);
601
+ }
602
+
603
+ .agent-new-session svg {
604
+ width: 14px;
605
+ height: 14px;
606
+ }
607
+
608
+ /* Session list nested under each agent */
609
+ .session-list {
610
+ list-style: none;
611
+ margin: 0 0 4px 0;
612
+ padding: 0 0 0 28px;
613
+ display: none;
614
+ flex-direction: column;
615
+ gap: 2px;
616
+ }
617
+
618
+ .agent-group.expanded .session-list {
619
+ display: flex;
620
+ }
621
+
622
+ .session-item {
623
+ display: flex;
624
+ align-items: center;
625
+ padding: 6px 10px;
626
+ border-radius: 5px;
627
+ cursor: pointer;
628
+ transition: var(--transition);
629
+ gap: 8px;
630
+ position: relative;
631
+ }
632
+
633
+ .session-item::before {
634
+ content: '';
635
+ width: 6px;
636
+ height: 6px;
637
+ border-radius: 50%;
638
+ background: var(--text-muted);
639
+ flex-shrink: 0;
640
+ transition: var(--transition);
641
+ }
642
+
643
+ .session-item:hover {
644
+ background: var(--bg-hover);
645
+ }
646
+
647
+ .session-item:hover::before {
648
+ background: var(--text-secondary);
649
+ }
650
+
651
+ .session-item.active {
652
+ background: var(--bg-active);
653
+ }
654
+
655
+ .session-item.active::before {
656
+ background: var(--accent);
657
+ box-shadow: 0 0 4px var(--accent-glow);
658
+ }
659
+
660
+ .session-item.active .session-name {
661
+ color: var(--accent);
662
+ font-weight: 500;
663
+ }
664
+
665
+ .session-name {
666
+ flex: 1;
667
+ font-size: 13px;
668
+ color: var(--text);
669
+ white-space: nowrap;
670
+ overflow: hidden;
671
+ text-overflow: ellipsis;
672
+ }
673
+
674
+ .session-delete {
675
+ width: 18px;
676
+ height: 18px;
677
+ border-radius: 4px;
678
+ background: transparent;
679
+ border: none;
680
+ color: var(--text-muted);
681
+ cursor: pointer;
682
+ display: flex;
683
+ align-items: center;
684
+ justify-content: center;
685
+ opacity: 0;
686
+ transition: var(--transition);
687
+ font-size: 12px;
688
+ line-height: 1;
689
+ }
690
+
691
+ .session-item:hover .session-delete {
692
+ opacity: 1;
693
+ }
694
+
695
+ .session-delete:hover {
696
+ background: var(--error-bg);
697
+ color: var(--error);
698
+ }
699
+
452
700
  /* Sidebar Footer */
453
701
  .sidebar-footer {
454
702
  padding: 16px;
@@ -1455,6 +1703,119 @@ body {
1455
1703
  padding: 40px 20px;
1456
1704
  }
1457
1705
 
1706
+ /* ============================================ */
1707
+ /* Wallet Manager */
1708
+ /* ============================================ */
1709
+ .wallet-list {
1710
+ display: flex;
1711
+ flex-direction: column;
1712
+ gap: 8px;
1713
+ max-height: 320px;
1714
+ overflow-y: auto;
1715
+ -webkit-overflow-scrolling: touch;
1716
+ overscroll-behavior: contain;
1717
+ contain: strict;
1718
+ margin-top: 8px;
1719
+ }
1720
+
1721
+ .wallet-empty {
1722
+ text-align: center;
1723
+ color: var(--text-secondary);
1724
+ padding: 24px 16px;
1725
+ font-size: 13px;
1726
+ border: 1px dashed var(--border);
1727
+ border-radius: var(--radius);
1728
+ }
1729
+
1730
+ .wallet-row {
1731
+ display: flex;
1732
+ align-items: center;
1733
+ gap: 10px;
1734
+ padding: 10px 12px;
1735
+ background: var(--bg-secondary);
1736
+ border: 1px solid var(--border);
1737
+ border-radius: var(--radius);
1738
+ transition: var(--transition);
1739
+ }
1740
+
1741
+ .wallet-row:hover {
1742
+ border-color: var(--accent);
1743
+ }
1744
+
1745
+ .wallet-row.is-active {
1746
+ border-color: var(--accent);
1747
+ background: var(--accent-glow);
1748
+ }
1749
+
1750
+ .wallet-row .wallet-chain {
1751
+ font-size: 10px;
1752
+ font-weight: 700;
1753
+ padding: 2px 6px;
1754
+ border-radius: 4px;
1755
+ background: var(--bg);
1756
+ color: var(--text-muted);
1757
+ letter-spacing: 0.5px;
1758
+ flex-shrink: 0;
1759
+ }
1760
+
1761
+ .wallet-row.is-active .wallet-chain {
1762
+ background: var(--accent);
1763
+ color: var(--bg);
1764
+ }
1765
+
1766
+ .wallet-row .wallet-info {
1767
+ flex: 1;
1768
+ min-width: 0;
1769
+ display: flex;
1770
+ flex-direction: column;
1771
+ gap: 2px;
1772
+ }
1773
+
1774
+ .wallet-row .wallet-agent {
1775
+ font-size: 13px;
1776
+ font-weight: 500;
1777
+ color: var(--text-primary);
1778
+ white-space: nowrap;
1779
+ overflow: hidden;
1780
+ text-overflow: ellipsis;
1781
+ }
1782
+
1783
+ .wallet-row .wallet-address {
1784
+ font-family: var(--font-mono);
1785
+ font-size: 11px;
1786
+ color: var(--text-muted);
1787
+ white-space: nowrap;
1788
+ overflow: hidden;
1789
+ text-overflow: ellipsis;
1790
+ }
1791
+
1792
+ .wallet-row .wallet-actions {
1793
+ display: flex;
1794
+ gap: 4px;
1795
+ flex-shrink: 0;
1796
+ }
1797
+
1798
+ .wallet-row .wallet-mini-btn {
1799
+ width: 26px;
1800
+ height: 26px;
1801
+ border-radius: 6px;
1802
+ background: transparent;
1803
+ border: 1px solid var(--border);
1804
+ color: var(--text-muted);
1805
+ cursor: pointer;
1806
+ display: inline-flex;
1807
+ align-items: center;
1808
+ justify-content: center;
1809
+ padding: 0;
1810
+ transition: var(--transition);
1811
+ }
1812
+
1813
+ .wallet-row .wallet-mini-btn:hover {
1814
+ background: var(--accent);
1815
+ color: var(--bg);
1816
+ border-color: var(--accent);
1817
+ }
1818
+
1458
1819
  .task-item {
1459
1820
  background: var(--bg-secondary);
1460
1821
  border: 1px solid var(--border);
@@ -3376,3 +3737,139 @@ body {
3376
3737
  80% { opacity: 1; }
3377
3738
  100% { opacity: 0; }
3378
3739
  }
3740
+
3741
+ /* ============================================ */
3742
+ /* Catalog: section header `+` button, badges */
3743
+ /* ============================================ */
3744
+
3745
+ .section-header-action {
3746
+ width: 22px;
3747
+ height: 22px;
3748
+ border-radius: 6px;
3749
+ background: transparent;
3750
+ border: 1px solid var(--border);
3751
+ color: var(--text-muted);
3752
+ cursor: pointer;
3753
+ display: inline-flex;
3754
+ align-items: center;
3755
+ justify-content: center;
3756
+ padding: 0;
3757
+ transition: var(--transition);
3758
+ }
3759
+
3760
+ .section-header-action:hover {
3761
+ background: var(--accent);
3762
+ color: var(--bg);
3763
+ border-color: var(--accent);
3764
+ }
3765
+
3766
+ .agent-row .agent-wallet-badge {
3767
+ display: inline-flex;
3768
+ align-items: center;
3769
+ justify-content: center;
3770
+ font-size: 10px;
3771
+ font-weight: 600;
3772
+ padding: 1px 5px;
3773
+ border-radius: 4px;
3774
+ background: var(--accent-glow);
3775
+ color: var(--accent);
3776
+ border: 1px solid var(--accent);
3777
+ letter-spacing: 0.3px;
3778
+ margin-left: 4px;
3779
+ flex-shrink: 0;
3780
+ }
3781
+
3782
+ .agent-row .agent-tools-badge {
3783
+ display: inline-flex;
3784
+ align-items: center;
3785
+ justify-content: center;
3786
+ font-size: 10px;
3787
+ font-weight: 600;
3788
+ padding: 1px 5px;
3789
+ border-radius: 4px;
3790
+ background: rgba(80, 200, 120, 0.12);
3791
+ color: rgb(80, 200, 120);
3792
+ border: 1px solid rgba(80, 200, 120, 0.4);
3793
+ margin-left: 4px;
3794
+ flex-shrink: 0;
3795
+ }
3796
+
3797
+ .agent-row .agent-row-meta {
3798
+ display: flex;
3799
+ align-items: center;
3800
+ gap: 4px;
3801
+ margin-left: auto;
3802
+ flex-shrink: 0;
3803
+ }
3804
+
3805
+ .agent-row .agent-config-btn {
3806
+ width: 22px;
3807
+ height: 22px;
3808
+ border-radius: 6px;
3809
+ background: transparent;
3810
+ border: 1px solid var(--border);
3811
+ color: var(--text-muted);
3812
+ cursor: pointer;
3813
+ display: inline-flex;
3814
+ align-items: center;
3815
+ justify-content: center;
3816
+ padding: 0;
3817
+ opacity: 0;
3818
+ transition: var(--transition);
3819
+ margin-left: 4px;
3820
+ }
3821
+
3822
+ .agent-row:hover .agent-config-btn {
3823
+ opacity: 1;
3824
+ }
3825
+
3826
+ .agent-row .agent-config-btn:hover {
3827
+ background: var(--accent);
3828
+ color: var(--bg);
3829
+ border-color: var(--accent);
3830
+ }
3831
+
3832
+ /* Form hints and info blocks in modals */
3833
+ .form-hint {
3834
+ display: block;
3835
+ margin-top: 4px;
3836
+ color: var(--text-muted);
3837
+ font-size: 11px;
3838
+ line-height: 1.4;
3839
+ }
3840
+
3841
+ .form-info {
3842
+ margin-top: 8px;
3843
+ padding: 10px 12px;
3844
+ background: var(--bg-secondary);
3845
+ border: 1px solid var(--border);
3846
+ border-radius: var(--radius);
3847
+ font-size: 12px;
3848
+ color: var(--text-secondary);
3849
+ word-break: break-all;
3850
+ }
3851
+
3852
+ .form-info code {
3853
+ font-family: var(--font-mono);
3854
+ color: var(--accent);
3855
+ background: var(--bg);
3856
+ padding: 1px 4px;
3857
+ border-radius: 3px;
3858
+ }
3859
+
3860
+ .checkbox-label {
3861
+ display: flex !important;
3862
+ align-items: center;
3863
+ gap: 8px;
3864
+ cursor: pointer;
3865
+ user-select: none;
3866
+ font-size: 13px;
3867
+ color: var(--text-secondary);
3868
+ }
3869
+
3870
+ .checkbox-label input[type="checkbox"] {
3871
+ width: 16px;
3872
+ height: 16px;
3873
+ cursor: pointer;
3874
+ accent-color: var(--accent);
3875
+ }
@@ -1,48 +0,0 @@
1
- /**
2
- * Judgment-Aware Context Router
3
- *
4
- * Extends ContextRouter with judgment lookup and injection capabilities.
5
- *
6
- * Architecture:
7
- * - Path → Fragment Names → Associated Judgments
8
- * - Confidence-based filtering
9
- * - YAML format for user-language injection
10
- *
11
- * Integration with existing Bollharness:
12
- * - Uses existing ContextRouter.match() for fragment lookup
13
- * - Extends with judgment lookup based on fragment context
14
- * - Injects at Gate 0, Gate 3, and file-edit time
15
- */
16
- import { type Judgment } from '../pi-ecosystem-judgment/index.js';
17
- export interface JudgmentInjectOptions {
18
- minConfidence: number;
19
- maxJudgments: number;
20
- format: 'yaml' | 'json' | 'text';
21
- includeEvidence: boolean;
22
- }
23
- export interface JudgmentContextResult {
24
- fragments: string[];
25
- judgments: Judgment[];
26
- contextYaml: string;
27
- confidence: number;
28
- }
29
- /**
30
- * Get judgments associated with a fragment name
31
- */
32
- export declare function getJudgmentsForFragment(fragmentName: string): Promise<Judgment[]>;
33
- /**
34
- * Get high-confidence judgments for a file path
35
- */
36
- export declare function getJudgmentsForPath(filePath: string, options?: Partial<JudgmentInjectOptions>): Promise<JudgmentContextResult>;
37
- /**
38
- * Get core judgments for session start (high confidence only)
39
- */
40
- export declare function getCoreJudgmentsForSession(minConfidence?: number): Promise<string>;
41
- /**
42
- * Get judgments for a specific context (e.g., "investment", "code-review")
43
- */
44
- export declare function getJudgmentsForContextRequest(context: string, options?: Partial<JudgmentInjectOptions>): Promise<JudgmentContextResult>;
45
- /**
46
- * Generate injection prompt for a file path
47
- */
48
- export declare function generateJudgmentInjection(filePath: string, gate: number, options?: Partial<JudgmentInjectOptions>): Promise<string>;