@vincentbanana/bananacli 0.8.13 → 0.8.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.
package/README.en.md CHANGED
@@ -36,7 +36,7 @@ A multi-provider AI agent for the terminal, with a local GUI. It can read and wr
36
36
  | |_) | (_| | | | | (_| | |_) | (_| | | | |
37
37
  |____/ \__,_|_| |_|\__,_|_.__/ \__,_|_| |_|
38
38
 
39
- BananaCLI v0.8.13 · terminal + GUI
39
+ BananaCLI v0.8.15 · terminal + GUI
40
40
  ```
41
41
 
42
42
  - **No frontend framework**: the CLI uses Node built-ins only; runtime dependencies are `ws` and `@lydell/node-pty` (prebuilt native module).
package/README.md CHANGED
@@ -34,7 +34,7 @@
34
34
  | |_) | (_| | | | | (_| | |_) | (_| | | | |
35
35
  |____/ \__,_|_| |_|\__,_|_.__/ \__,_|_| |_|
36
36
 
37
- BananaCLI v0.8.13 · 终端 + 图形界面
37
+ BananaCLI v0.8.15 · 终端 + 图形界面
38
38
  ```
39
39
 
40
40
  - **无前端框架依赖**:CLI 只用 Node 内置模块;运行时依赖 `ws`(GUI/终端 WebSocket)和 `@lydell/node-pty`(预编译原生模块)。
@@ -3,6 +3,7 @@
3
3
  "bg": "#fafafa",
4
4
  "bgDeep": "#ffffff",
5
5
  "panel": "#f2f2f2",
6
+ "surface": "#fbfbfb",
6
7
  "panel2": "#ededed",
7
8
  "border": "rgba(0,0,0,0.08)",
8
9
  "borderStrong": "rgba(0,0,0,0.16)",
@@ -17,7 +18,15 @@
17
18
  "radius": { "none": 0, "sm": 4, "md": 6, "lg": 8 },
18
19
  "shadow": {
19
20
  "sm": "0 1px 2px rgba(16,16,20,0.05)",
20
- "overlay": "0 12px 32px rgba(16,16,20,0.14)"
21
+ "overlay": "0 8px 24px rgba(16,16,20,0.10)"
22
+ },
23
+ "motion": {
24
+ "default": "off",
25
+ "levels": {
26
+ "subtle": { "label": "克制", "duration": 180, "shift": 4, "press": 0.975, "spring": "cubic-bezier(0.28,1.04,0.5,1)", "scroll": 0.15 },
27
+ "natural": { "label": "自然", "duration": 240, "shift": 7, "press": 0.96, "spring": "cubic-bezier(0.22,1.16,0.36,1)", "scroll": 0.11 },
28
+ "playful": { "label": "明显", "duration": 300, "shift": 10, "press": 0.94, "spring": "cubic-bezier(0.2,1.4,0.34,1)", "scroll": 0.085 }
29
+ }
21
30
  },
22
31
  "spacing": { "unit": 4, "scale": [4, 8, 12, 16, 24, 32, 40, 48] },
23
32
  "typography": {
package/dist/ui/app.js CHANGED
@@ -555,6 +555,57 @@ function prefersReducedMotion() {
555
555
  );
556
556
  }
557
557
 
558
+ // ---------------- 灵动动效 ----------------
559
+ const MOTION_KEY = 'banana.motion';
560
+ const MOTION_LEVEL_KEY = 'banana.motion.level';
561
+ const MOTION_LEVELS = ['subtle', 'natural', 'playful'];
562
+
563
+ function motionOn() {
564
+ try {
565
+ return localStorage.getItem(MOTION_KEY) === '1';
566
+ } catch {
567
+ return false;
568
+ }
569
+ }
570
+
571
+ function motionLevel() {
572
+ try {
573
+ const value = localStorage.getItem(MOTION_LEVEL_KEY);
574
+ return MOTION_LEVELS.includes(value) ? value : 'natural';
575
+ } catch {
576
+ return 'natural';
577
+ }
578
+ }
579
+
580
+ function motionEffective() {
581
+ return motionOn() && !prefersReducedMotion();
582
+ }
583
+
584
+ function applyMotion() {
585
+ const root = document.documentElement;
586
+ root.dataset.motion = motionEffective() ? '1' : '0';
587
+ root.dataset.motionLevel = motionLevel();
588
+ }
589
+
590
+ function setMotion(on) {
591
+ try {
592
+ localStorage.setItem(MOTION_KEY, on ? '1' : '0');
593
+ } catch {}
594
+ applyMotion();
595
+ }
596
+
597
+ function setMotionLevel(level) {
598
+ try {
599
+ localStorage.setItem(MOTION_LEVEL_KEY, MOTION_LEVELS.includes(level) ? level : 'natural');
600
+ } catch {}
601
+ applyMotion();
602
+ }
603
+
604
+ function motionScrollFactor() {
605
+ if (!motionEffective()) return 0.12;
606
+ return { subtle: 0.15, natural: 0.11, playful: 0.085 }[motionLevel()];
607
+ }
608
+
558
609
  function stopCamera() {
559
610
  camera.running = false;
560
611
  if (camera.raf) cancelAnimationFrame(camera.raf);
@@ -581,7 +632,7 @@ function cameraTick() {
581
632
  stopCamera();
582
633
  return;
583
634
  }
584
- const step = Math.min(64, Math.max(1, distance * 0.12));
635
+ const step = Math.min(64, Math.max(1, distance * motionScrollFactor()));
585
636
  THREAD.scrollTop = current + step;
586
637
  camera.lastTop = THREAD.scrollTop;
587
638
  camera.programmaticAt = Date.now();
@@ -1912,7 +1963,9 @@ function renderThreadPlan() {
1912
1963
  function renderPendingPlan(plan) {
1913
1964
  THREAD.querySelector('.plan-card')?.remove();
1914
1965
  if (!plan || plan.status === 'cancelled') return;
1915
- THREAD.appendChild(planCardNode(plan));
1966
+ const card = planCardNode(plan);
1967
+ card.classList.add('is-new');
1968
+ THREAD.appendChild(card);
1916
1969
  scrollToEnd();
1917
1970
  }
1918
1971
 
@@ -3544,6 +3597,42 @@ function renderAppearanceSettings(body) {
3544
3597
  );
3545
3598
  section.appendChild(card);
3546
3599
 
3600
+ const lively = settingsCard();
3601
+ const motionSuppressed =
3602
+ document.documentElement.dataset.reduceMotion === '1' ||
3603
+ window.matchMedia('(prefers-reduced-motion: reduce)').matches;
3604
+ lively.appendChild(
3605
+ settingsRow(
3606
+ '灵动动效',
3607
+ '测试功能:消息、按钮和面板带自然弹力与阻尼;终端与代码区不受影响。' +
3608
+ (motionSuppressed ? ' 当前“减少动效”已开启,开启后也不会生效。' : ''),
3609
+ settingsSwitch(motionOn(), (on) => {
3610
+ setMotion(on);
3611
+ renderSettings();
3612
+ toast(on ? '灵动动效已开启' : '灵动动效已关闭');
3613
+ }),
3614
+ ),
3615
+ );
3616
+ lively.appendChild(
3617
+ settingsRow(
3618
+ '动效强度',
3619
+ '阻尼越大越收得住;大面板不会来回晃。',
3620
+ settingsSeg(
3621
+ [
3622
+ { value: 'subtle', label: '克制' },
3623
+ { value: 'natural', label: '自然' },
3624
+ { value: 'playful', label: '明显' },
3625
+ ],
3626
+ motionLevel(),
3627
+ (value) => {
3628
+ setMotionLevel(value);
3629
+ toast('动效强度:' + (value === 'subtle' ? '克制' : value === 'playful' ? '明显' : '自然'));
3630
+ },
3631
+ ),
3632
+ ),
3633
+ );
3634
+ section.appendChild(lively);
3635
+
3547
3636
  const motion = settingsCard();
3548
3637
  motion.appendChild(
3549
3638
  settingsRow('减少动效', '关闭大部分弹簧和入场动画,适合晕动或低性能设备。', settingsSwitch(
@@ -3552,6 +3641,7 @@ function renderAppearanceSettings(body) {
3552
3641
  if (on) document.documentElement.dataset.reduceMotion = '1';
3553
3642
  else delete document.documentElement.dataset.reduceMotion;
3554
3643
  localStorage.setItem('banana.reduceMotion', on ? '1' : '0');
3644
+ applyMotion();
3555
3645
  toast(on ? '已减少动效' : '已恢复弹力动画');
3556
3646
  },
3557
3647
  )),
@@ -5584,6 +5674,7 @@ async function maybePromptProjectTrust() {
5584
5674
  async function boot() {
5585
5675
  bind();
5586
5676
  applyLanguage();
5677
+ applyMotion();
5587
5678
  // 命令表来自服务端(与 CLI 同一份),拉不到也不影响对话
5588
5679
  try {
5589
5680
  const all = (await get('commands')).commands ?? [];
package/dist/ui/style.css CHANGED
@@ -3,6 +3,7 @@
3
3
  --bg-deep: #fafafa;
4
4
  --bg: #ffffff;
5
5
  --panel: #f2f2f2;
6
+ --surface: #fbfbfb;
6
7
  --panel-2: #ededed;
7
8
  --panel-3: #e6e6e6;
8
9
  --line: rgba(0, 0, 0, 0.08);
@@ -48,7 +49,7 @@
48
49
 
49
50
  --shadow-sm: 0 1px 2px rgba(16, 16, 20, 0.05);
50
51
  --shadow-1: var(--shadow-sm);
51
- --shadow-overlay: 0 12px 32px rgba(16, 16, 20, 0.14);
52
+ --shadow-overlay: 0 8px 24px rgba(16, 16, 20, 0.10);
52
53
  --shadow-lg: var(--shadow-overlay);
53
54
  --shadow-raised: var(--shadow-sm);
54
55
 
@@ -73,6 +74,7 @@
73
74
  --bg-deep: #080808;
74
75
  --bg: #161616;
75
76
  --panel: #1e1e1e;
77
+ --surface: #1c1c1c;
76
78
  --panel-2: #242424;
77
79
  --panel-3: #2e2e2e;
78
80
  --line: rgba(255, 255, 255, 0.08);
@@ -96,7 +98,7 @@
96
98
  --info: #82bdbd;
97
99
  --on-danger: #ffffff;
98
100
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
99
- --shadow-overlay: 0 16px 40px rgba(0, 0, 0, 0.55);
101
+ --shadow-overlay: 0 8px 24px rgba(0, 0, 0, 0.40);
100
102
  --shadow-lg: var(--shadow-overlay);
101
103
  --shadow-raised: var(--shadow-sm);
102
104
  }
@@ -106,6 +108,7 @@
106
108
  --bg-deep: #080808;
107
109
  --bg: #161616;
108
110
  --panel: #1e1e1e;
111
+ --surface: #1c1c1c;
109
112
  --panel-2: #242424;
110
113
  --panel-3: #2e2e2e;
111
114
  --line: rgba(255, 255, 255, 0.08);
@@ -129,7 +132,7 @@
129
132
  --info: #82bdbd;
130
133
  --on-danger: #ffffff;
131
134
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
132
- --shadow-overlay: 0 16px 40px rgba(0, 0, 0, 0.55);
135
+ --shadow-overlay: 0 8px 24px rgba(0, 0, 0, 0.40);
133
136
  --shadow-lg: var(--shadow-overlay);
134
137
  --shadow-raised: var(--shadow-sm);
135
138
  }
@@ -4231,8 +4234,8 @@ input:focus-visible, textarea:focus-visible { outline: none; }
4231
4234
  .msg.assistant .msg-role::before { background: var(--accent-ink); opacity: 0.45; }
4232
4235
  .msg.assistant .msg-role { color: var(--text-3); }
4233
4236
  .msg.user .msg-body {
4234
- background: var(--panel);
4235
- border-color: var(--line-strong);
4237
+ background: var(--surface);
4238
+ border-color: var(--line);
4236
4239
  padding: 10px 14px;
4237
4240
  }
4238
4241
 
@@ -4278,8 +4281,8 @@ input:focus-visible, textarea:focus-visible { outline: none; }
4278
4281
 
4279
4282
  /* 输入区:与聊天区同宽,工具栏与输入框分层 */
4280
4283
  .composer {
4281
- background: var(--panel);
4282
- border-color: var(--line-strong);
4284
+ background: var(--surface);
4285
+ border-color: var(--line);
4283
4286
  padding: 8px 10px 8px 14px;
4284
4287
  }
4285
4288
  .composer textarea { font-size: 14.5px; line-height: 1.6; }
@@ -4326,9 +4329,76 @@ input:focus-visible, textarea:focus-visible { outline: none; }
4326
4329
  transition: width 200ms var(--ease);
4327
4330
  }
4328
4331
 
4332
+ /* ---------- 灵动动效(测试功能,默认关闭) ---------- */
4333
+ :root[data-motion='1'] {
4334
+ --motion-dur: 340ms;
4335
+ --motion-dur-slow: 380ms;
4336
+ --motion-spring: linear(0, 0.026 5%, 0.091 10%, 0.179 15%, 0.278 20%, 0.379 25%, 0.478 30%, 0.569 35%, 0.652 40%, 0.724 45%, 0.786 50%, 0.837 55%, 0.88 60%, 0.915 65%, 0.942 70%, 0.963 75%, 0.979 80%, 0.991 85%, 0.999 90%, 1.005 95%, 1 100%);
4337
+ --motion-spring-panel: linear(0, 0.021 5%, 0.073 10%, 0.143 15%, 0.224 20%, 0.308 25%, 0.391 30%, 0.471 35%, 0.545 40%, 0.612 45%, 0.672 50%, 0.725 55%, 0.771 60%, 0.811 65%, 0.845 70%, 0.874 75%, 0.898 80%, 0.918 85%, 0.935 90%, 0.949 95%, 1 100%);
4338
+ --motion-shift: 7px;
4339
+ --motion-press: 0.96;
4340
+ }
4341
+ :root[data-motion='1'][data-motion-level='subtle'] {
4342
+ --motion-dur: 260ms;
4343
+ --motion-dur-slow: 300ms;
4344
+ --motion-spring: linear(0, 0.019 5%, 0.068 10%, 0.135 15%, 0.211 20%, 0.291 25%, 0.37 30%, 0.446 35%, 0.517 40%, 0.582 45%, 0.641 50%, 0.694 55%, 0.74 60%, 0.781 65%, 0.816 70%, 0.846 75%, 0.872 80%, 0.894 85%, 0.913 90%, 0.928 95%, 1 100%);
4345
+ --motion-spring-panel: linear(0, 0.018 5%, 0.062 10%, 0.123 15%, 0.193 20%, 0.267 25%, 0.34 30%, 0.412 35%, 0.479 40%, 0.541 45%, 0.599 50%, 0.65 55%, 0.696 60%, 0.737 65%, 0.774 70%, 0.805 75%, 0.833 80%, 0.857 85%, 0.878 90%, 0.896 95%, 1 100%);
4346
+ --motion-shift: 4px;
4347
+ --motion-press: 0.975;
4348
+ }
4349
+ :root[data-motion='1'][data-motion-level='playful'] {
4350
+ --motion-dur: 420ms;
4351
+ --motion-dur-slow: 460ms;
4352
+ --motion-spring: linear(0, 0.041 5%, 0.143 10%, 0.278 15%, 0.424 20%, 0.567 25%, 0.696 30%, 0.806 35%, 0.895 40%, 0.962 45%, 1.011 50%, 1.042 55%, 1.06 60%, 1.067 65%, 1.067 70%, 1.062 75%, 1.053 80%, 1.044 85%, 1.034 90%, 1.024 95%, 1 100%);
4353
+ --motion-spring-panel: linear(0, 0.024 5%, 0.085 10%, 0.167 15%, 0.26 20%, 0.356 25%, 0.449 30%, 0.537 35%, 0.617 40%, 0.688 45%, 0.749 50%, 0.802 55%, 0.847 60%, 0.883 65%, 0.913 70%, 0.937 75%, 0.956 80%, 0.971 85%, 0.982 90%, 0.99 95%, 1 100%);
4354
+ --motion-shift: 10px;
4355
+ --motion-press: 0.94;
4356
+ }
4357
+
4358
+ @keyframes motionIn {
4359
+ from { opacity: 0; transform: translateY(var(--motion-shift, 6px)) scale(0.996); }
4360
+ to { opacity: 1; transform: none; }
4361
+ }
4362
+
4363
+ :root[data-motion='1'] .msg.enter,
4364
+ :root[data-motion='1'] .plan-card.is-new {
4365
+ animation: motionIn var(--motion-dur-slow) var(--motion-spring) both;
4366
+ }
4367
+
4368
+ :root[data-motion='1'] .btn:active,
4369
+ :root[data-motion='1'] .icon-btn:active,
4370
+ :root[data-motion='1'] .chip-btn:active,
4371
+ :root[data-motion='1'] .send-btn:not(:disabled):active,
4372
+ :root[data-motion='1'] .session-item:active {
4373
+ transform: scale(var(--motion-press));
4374
+ transition-duration: 90ms;
4375
+ }
4376
+
4377
+ :root[data-motion='1'] .review.is-opening {
4378
+ animation: reviewIn var(--motion-dur) var(--motion-spring-panel) both;
4379
+ }
4380
+ :root[data-motion='1'] .model-pop,
4381
+ :root[data-motion='1'] .reasoning-pop,
4382
+ :root[data-motion='1'] .modal-card {
4383
+ animation: pop var(--motion-dur) var(--motion-spring-panel) both;
4384
+ }
4385
+ :root[data-motion='1'] .sidebar {
4386
+ transition-timing-function: var(--motion-spring-panel);
4387
+ transition-duration: var(--motion-dur);
4388
+ }
4389
+
4390
+ :root[data-motion='1'] .todo-bar i,
4391
+ :root[data-motion='1'] .task-chip-bar i {
4392
+ transition: width var(--motion-dur) var(--motion-spring);
4393
+ }
4394
+
4395
+ /* 去掉模板感:输入区和主卡片不再抬高 */
4396
+ .composer { box-shadow: none; }
4397
+ .composer:focus-within { box-shadow: none; }
4398
+ .chat-card { box-shadow: none; }
4399
+
4329
4400
  /* 顶栏和聊天头部:少一点装饰,多一点边界 */
4330
4401
  .topbar { height: 50px; }
4331
4402
  .chat-head { height: 46px; }
4332
4403
  .chat-title { font-size: 13.5px; }
4333
- .chat-card { box-shadow: var(--shadow-sm); }
4334
4404
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincentbanana/bananacli",
3
- "version": "0.8.13",
3
+ "version": "0.8.15",
4
4
  "description": "A multi-provider AI agent for your terminal: file tools, shell, web search, persistent sessions, diff preview and undo",
5
5
  "type": "module",
6
6
  "engines": {