New Session clears onto the empty-state launch
New Session clears onto the empty-state launch
Sidebar "New Session" created and opened a blank session immediately, so the center column showed `ConversationRoot` with an empty transcript and the resident composer. The Figma NEW SESSION screen (`EmptyState` + shared `InputBar` hero) only rendered when `sessions.current` was already undefined, so the launch page was unreachable from the primary creation control.
English
Problem
Sidebar "New Session" created and opened a blank session immediately, so the center column showed ConversationRoot with an empty transcript and the resident composer. The Figma NEW SESSION screen (EmptyState + shared InputBar hero) only rendered when sessions.current was already undefined, so the launch page was unreachable from the primary creation control.
Decision
SessionsService.clear() wipes the persisted selection and list.current. Top-level sidebar creation entries (onCreate() with no cwd — New Session and New Workspace) call clear() so AppFrame renders conversation.empty. The empty state's first send still runs conversation.startSession (create → open → send) and reuses the same InputBar component as the resident composer (variant="hero"). Per-project "+" (onCreate(cwd)) keeps create-then-open until the empty-state picker can accept a seeded cwd.
Alternatives considered
Keep create-then-open for New Session and add a second empty chrome inside ConversationRoot when the transcript is empty. Rejected: that duplicates the launch InputBar and breaks the empty→content ruling that one InputBar moves position rather than swapping components.
Route New Session through a dedicated route or slot outside selection. Rejected for this pass: conversation.empty already owns the launch UI; clearing current is the existing empty branch.
Consequences
New Session no longer mints a host session until the first send. Reloading after clear stays on the empty state. Project-scoped "+" still creates immediately. EmptyState stacks the Figma hero (Input_Bottom 75:8208) as fish + title, a Menu-backed workspace chip above the card, then shared InputBar (variant="hero", max-width 800, r20 card matching the composer — not a taller r24 hero), with a soft ellipse glow (figma 313:14109) centered behind the picker + card and width-locked to the card (1051/776 asset ratio) so it scales with it. The chip uses the soft interactive hover fill + 12px radius from 75:8208 and opens MenuDropdown (figma 122:9481; --dsw-specific-menu + --dsw-shadow-lv3): basename rows with folder icons and a trailing check, then a separator and "New Workspace" whose submenu (figma 419:16920) offers "Use a existing folder" and "Create new". Use a existing folder opens the path Dialog (figma 451:18655 copy — "Enter an existing folder path" / Open Folder) over a full-viewport mask (--dsw-alias-bg-mask-1 + --dsw-mask-blur) and sets the chip cwd. Create new opens the same Dialog chrome to name a folder under host.describe().cwd; success runs sessions.createWorkspace → host session.create (mkdir recursive) → sessions.open, so a default session lands in the new workspace. InputBar paints the bottom chrome (attach / Plan / Read-only / model) with local native <select> state only — host plan, access, and model seams remain unwired.
中文
Problem
侧栏「New Session」会立即创建并打开空白会话,因此中间栏显示带空 transcript(文本记录)与常驻 composer 的 ConversationRoot。Figma 的 NEW SESSION 屏(EmptyState + 共用的 InputBar hero)仅在 sessions.current 已为 undefined 时渲染,因而主创建控件无法到达启动页。
Decision
SessionsService.clear() 清除持久化选中项与 list.current。顶层侧栏创建入口(无 cwd 的 onCreate()——New Session 与 New Workspace)调用 clear(),使 AppFrame 渲染 conversation.empty。空态的首次发送仍走 conversation.startSession(create → open → send),并复用与常驻 composer 相同的 InputBar 组件(variant="hero")。按项目的「+」(onCreate(cwd))继续 create-then-open,直到空态选择器能接受预填的 cwd。
Alternatives considered
为 New Session 保留 create-then-open,并在 transcript 为空时于 ConversationRoot 内再加一套空态 chrome。 否决:这会重复启动页的 InputBar,并破坏 empty→content 的约定——同一 InputBar 应移动位置,而非互换组件。
将 New Session 路由到选中状态之外的专用 route 或 slot。 本轮否决:conversation.empty 已拥有启动 UI;清除 current 即是既有的空态分支。
Consequences
New Session 在首次发送前不再创建 host 会话。clear 后重新加载仍停留在空态。项目范围的「+」仍立即创建。EmptyState 按 Figma 堆叠英雄区(Input_Bottom 75:8208):鱼标 + 标题、卡片上方由 Menu 驱动的工作区 chip,再接共用的 InputBar(variant="hero",max-width 800,与 composer 一致的 r20 卡片——而非更高的 r24 英雄区),选择器与卡片背后居中铺一层柔光椭圆(figma 313:14109),宽度按卡片锁定为 1051/776 asset 比例,随卡片缩放。Chip 采用 75:8208 的柔和交互 hover 填充与 12px 圆角,并打开 MenuDropdown(figma 122:9481;--dsw-specific-menu + --dsw-shadow-lv3):带文件夹图标与尾随勾选的 basename 行,分隔线后是 "New Workspace",其子菜单(figma 419:16920)提供 "Use a existing folder" 与 "Create new"。Use a existing folder 打开路径 Dialog(figma 451:18655 copy — "Enter an existing folder path" / Open Folder),置于全视口遮罩(--dsw-alias-bg-mask-1 + --dsw-mask-blur)之上,并设置 chip 的 cwd。Create new 打开同一套 Dialog chrome,在 host.describe().cwd 下命名文件夹;成功则走 sessions.createWorkspace → host session.create(mkdir recursive)→ sessions.open,在新 workspace 中默认落下一会话。InputBar 绘制底栏 chrome(attach / Plan / Read-only / model),仅用本地原生 <select> 状态——host 侧的 plan、access、model 接缝仍未接线。