ytahdn c18385ec02
feat(web-shell): UI improvements, subagent rendering, and scroll-follow rewrite (#4655)
* feat(web-shell): improve UI components and message formatting

- Refine dialog styles, editor layout, and welcome header
- Add tool formatting utilities with tests
- Update message list, shortcuts panel, and agent dialog
- Improve markdown rendering and tool chrome styles
- Enhance input history hook and i18n support

* feat(web-shell): improve /tools, /skills, agents dialog and compact mode

- /tools: show simple list by default, /tools desc opens detail dialog
- /tools, /skills: insert user message before showing results
- AgentsDialog: add onMessage callback for success feedback, add Ctrl+D
  shortcut for delete in manage mode, show shortcut hint in detail view
- AgentsDialog create form: add arrow key hint in footer
- ToolsDialog: hide show-details and disable buttons
- DialogPrimitives: enlarge item prefix indicator, add shortcut style
- Fix compact mode dispatching duplicate status messages
- Update i18n descriptions to align with CLI behavior

* feat(web-shell): virtual scrolling, rendering perf, and Shift+Tab approval mode cycling

- Introduce @tanstack/react-virtual for virtualized message list scrolling,
  reducing DOM node count for long conversations
- Add WeakMap-based JSON stringify cache and reference equality fast path
  in MessageItem memo comparator
- Add useShallowMemo/useStableArray hooks to stabilize pendingApproval,
  floatingTodos, and floatingAgents references
- Add Shiki code highlighting LRU cache (128 entries) with synchronous
  cache-hit path
- Add custom areToolLinePropsEqual comparator for ToolLine memo and narrow
  useEffect deps in ToolGroup
- Align Shift+Tab with CLI: cycle approval modes (plan → default →
  auto-edit → auto → yolo) instead of direct allow_always submission
- Auto-approve pending permission on mode change: yolo approves all,
  auto-edit approves edit tools only (via toolCall.kind from daemon event)
- Add toolKind field to PermissionRequest extracted from toolCall.kind
- Add auto mode status bar indicator with warning color
- Show auto mode entry notice in message area
- Remove mouse hover interaction on ToolApproval to avoid confusion
  with keyboard selection

Generated with AI

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* feat(web-shell,webui,sdk): subagent rendering, scroll, and transcript fixes

- Synthesize tool.update in normalizer for Agent permission_request to fix
  orphaned sub-tool blocks when daemon skips emitStart
- Rewrite transcriptToMessages to match agent completions by callId instead
  of stack order, fixing parallel agent merge/cancel/background scenarios
- Add background agent detection: keep status as pending with no endTime
  for agents launched with run_in_background or status:'background'
- Handle cancelled/canceled agent status with proper rawOutput enrichment
  (status + reason fields) and display as failed in UI components
- Improve scroll-to-bottom: track programmatic vs user scrolls, use
  followBottomSignal from submit, fix auto-scroll sticking on user scroll-up
- Add isNavigating to useInputHistory so ArrowUp/Down prioritizes history
  browsing over autocomplete dropdown
- Render Agent tools inline in ToolGroup with summary line (type, description,
  tool count, elapsed, tokens, cancellation reason) and expandable SubAgentPanel
- Support sub-tool approval matching: recurse into subTools tree to find
  pending approval targets within nested agents
- Add i18n keys for approval options and request.cancelled (EN + ZH)
- Bump base font size from 12px to 14px in App and Markdown
- Add maxBlocks config prop to DaemonSessionProvider
- Increase ActiveAgentsPanel MAX_VISIBLE from 5 to 10
- Add virtualizer getItemKey and useAnimationFrameWithResizeObserver
- Extensive test coverage for transcript conversion edge cases

* refactor(web-shell): rewrite scroll-follow logic with 6 clear rules

Replace the previous scroll implementation (5 overlapping effects,
4 fragile refs, rAF-based programmaticScroll flag) with a clean,
predictable design driven by 6 documented rules:

1. Default follow-bottom on content height changes via single
   useLayoutEffect on virtualizer totalSize
2. Scroll-up pauses follow (direction detection in onScroll)
3. Scroll-back-to-bottom (< 30px) resumes follow
4. New user message forces follow on
5. Session restore: suppress scroll during catchingUp, scroll
   once on replay_complete transition
6. Short content (no scrollbar): scrollToBottom is a no-op

- Remove followBottomSignal state and handleEditorSubmit wrapper
  from App.tsx; pass connection.catchingUp to MessageList instead
- Consolidate from 5 effects to 3, from 4 refs to 3
- Add detailed block comment documenting all 6 rules and the
  implementation structure

* fix(web-shell): stabilize daemon transcript rendering

* fix(web-shell): refine agent rendering feedback

* fix(web-shell): address review feedback

* chore(sdk): bump browser bundle size limit to 105KB

The daemon browser SDK bundle grew to ~103KB due to normalizer
enhancements for permission-based subagent rendering.

* fix(web-shell): address review feedback

* fix(web-shell): address review feedback

* fix(webui): avoid duplicate ask user question prompt

* fix(web-shell): sync package lockfile

---------

Co-authored-by: ytahdn <ytahdn@gmail.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-06-01 11:20:41 +08:00

156 lines
3.2 KiB
CSS

.app {
--font-mono:
'SF Mono', 'Fira Code', 'JetBrains Mono', 'Cascadia Code', monospace;
--font-sans:
-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
--radius: 6px;
position: relative;
display: flex;
flex-direction: column;
height: 100%;
padding: 12px 24px;
background: var(--app-bg);
color: var(--text-primary);
font-family: var(--font-mono);
font-size: 14px;
line-height: 1.5;
overflow: hidden;
}
.app,
.app * {
box-sizing: border-box;
}
.themeDark {
--app-bg: #111;
--bg-primary: #0d0d0d;
--bg-secondary: #161616;
--bg-tertiary: #1e1e1e;
--bg-surface: #1a1a1a;
--border-color: #2a2a2a;
--text-primary: #e4e4e4;
--text-secondary: #a0a0a0;
--text-dimmed: #666;
--accent-color: #4a9eff;
--accent-hover: #3a8eef;
--success-color: #48bb78;
--warning-color: #ecc94b;
--error-color: #fc8181;
--user-color: #48bb78;
--assist-color: #b794f4;
--welcome-logo-gradient: linear-gradient(
90deg,
#4796e4 0%,
#847ace 52%,
#c3677f 100%
);
--editor-bg: #0a0a0a;
--msg-body-color: #e3bcfe;
--thinking-pre-color: #9d9ec6;
--subtle-bg: rgba(255, 255, 255, 0.04);
--subtle-bg-strong: rgba(255, 255, 255, 0.06);
--info-bg: rgba(74, 158, 255, 0.08);
--info-border: rgba(74, 158, 255, 0.2);
--success-bg: rgba(72, 187, 120, 0.12);
--warning-bg: rgba(236, 201, 75, 0.08);
--warning-border: rgba(236, 201, 75, 0.2);
--error-bg: rgba(252, 129, 129, 0.08);
--error-border: rgba(252, 129, 129, 0.2);
}
.themeLight {
--app-bg: #FFF;
--bg-primary: #ffffff;
--bg-secondary: #f7f7f2;
--bg-tertiary: #efeee8;
--bg-surface: #f5f4ed;
--border-color: #d8d6cc;
--text-primary: #22231f;
--text-secondary: #5f6259;
--text-dimmed: #8b8d84;
--accent-color: #0b66c3;
--accent-hover: #0756a6;
--success-color: #1f7a3a;
--warning-color: #9a6a00;
--error-color: #c0362c;
--user-color: #0a7a3d;
--assist-color: #7b4ab8;
--welcome-logo-gradient: linear-gradient(
90deg,
#0b66c3 0%,
#7357b8 52%,
#bd4f67 100%
);
--editor-bg: #f7f7f2;
--msg-body-color: #0b6f3a;
--thinking-pre-color: #74788f;
--subtle-bg: rgba(32, 31, 25, 0.05);
--subtle-bg-strong: rgba(32, 31, 25, 0.08);
--info-bg: rgba(11, 102, 195, 0.08);
--info-border: rgba(11, 102, 195, 0.22);
--success-bg: rgba(31, 122, 58, 0.11);
--warning-bg: rgba(154, 106, 0, 0.1);
--warning-border: rgba(154, 106, 0, 0.24);
--error-bg: rgba(192, 54, 44, 0.1);
--error-border: rgba(192, 54, 44, 0.24);
}
.dialogOverlay {
position: absolute;
inset: 0;
z-index: 10;
display: flex;
flex-direction: column;
background: var(--app-bg);
}
.content {
flex: 0 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.contentHasMessages {
flex: 1 1 auto;
}
.footer {
margin: 0 -12px;
flex-shrink: 0;
}
.bottomPanels {
display: flex;
flex-direction: column;
gap: 4px;
padding-bottom: 4px;
}
.composer {
flex-shrink: 0;
padding: 0;
}
.queuedPrompts {
display: flex;
flex-direction: column;
gap: 2px;
padding: 0 12px 6px 36px;
color: var(--text-dimmed);
font-size: 12px;
line-height: 1.4;
}
.queuedPrompt {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.queuedHint {
font-style: italic;
}