/* ============================================================ pi2 console — chat page v0.1.1 Chat IA v3 (CHG-2026-10-23-02 / -10 / -11 / -12 / -13 / -17) ≥1100 tree 280px | stream — two columns, no right panel 1000–1099 tree 240px | stream, --stream-pad: 18px <1000 single column + tree drawer (`.tree-open`) <600 tree drawer = 44px touch rows + safe-area padding The tree is fixed on desktop: no rail, no drag handle, no panel and no collapse-all at pane level — collapsing is per node. Session row actions live in a body-level popover (`.tree-pop`). The shell grid is mirrored by `.chat-page--v3` in chat-tray.css (tray workflow) — keep the two in sync. ============================================================ */ .chat-page { --tree-w: 280px; --stream-pad: 20px; position: relative; display: grid; grid-template-columns: var(--tree-w) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: calc(100dvh - var(--topbar-h)); margin: calc(-1 * var(--space-6)); overflow: hidden; background: var(--background); } @media (min-width: 1000px) and (max-width: 1099px) { .chat-page { --tree-w: 240px; --stream-pad: 18px; } } /* <1000: the tree leaves the grid and becomes a drawer. */ @media (max-width: 999px) { .chat-page { --stream-pad: 14px; grid-template-columns: minmax(0, 1fr); } } @media (max-width: 599px) { .chat-page { --stream-pad: 12px; } } .chat-page .badge { white-space: nowrap; flex: none; } .chat-page .chip { white-space: nowrap; flex: none; } /* ---------- left: session tree(单 workspace + 仅缩进的嵌套) ---------- */ .tree-pane { display: flex; min-width: 0; min-height: 0; background: var(--sidebar); border-right: 1px solid var(--border-subtle); overflow: hidden; } .tree-inner { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; } .pane-head { position: relative; flex: none; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-bottom: 1px solid var(--border-subtle); } .tree-head-row { display: flex; align-items: center; gap: 4px; min-width: 0; } .tree-head__switch { flex: 1; min-width: 0; } /* workspace 下拉:左栏只承载一个 workspace */ .ws-switch-row { display: flex; align-items: center; gap: 4px; min-width: 0; } .ws-switch { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--card); color: var(--secondary-foreground); font-size: var(--fs-sm); font-weight: 550; text-align: left; transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out); } .ws-switch:hover { background: var(--surface-1); border-color: var(--border); } .ws-switch:disabled { opacity: 0.6; cursor: not-allowed; } .ws-switch svg { flex: none; width: 14px; height: 14px; color: var(--faint); } .ws-switch__name { flex: 1; min-width: 0; } .ws-switch__count { flex: none; font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--faint); } .ws-switch__caret { display: inline-flex; flex: none; color: var(--faint); transition: transform var(--dur-fast) var(--ease-out); } .ws-switch__caret svg { width: 13px; height: 13px; } .ws-switch[aria-expanded="true"] .ws-switch__caret { transform: rotate(180deg); } .ws-menu { position: absolute; left: 8px; right: 8px; top: 42px; z-index: 12; display: flex; flex-direction: column; background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-height: min(50vh, 22rem); overflow: hidden; } .ws-menu[hidden] { display: none; } /* 搜索框固定在顶部,只有下面的列表滚动 */ .ws-menu__search { display: flex; flex: none; align-items: center; gap: 6px; padding: 0 8px; border-bottom: 1px solid var(--border-subtle); } .ws-menu__search svg { flex: none; width: 14px; height: 14px; color: var(--faint); } .ws-menu__input { flex: 1; min-width: 0; height: 34px; min-height: 34px; padding: 0; border: 0; background: transparent; color: var(--foreground); font-size: var(--fs-sm); appearance: none; outline: none; } .ws-menu__input::-webkit-search-cancel-button { appearance: none; } .ws-menu__input::placeholder { color: var(--faint); } .ws-menu__clear { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: var(--radius-sm); color: var(--faint); } .ws-menu__clear:hover { background: var(--surface-2); color: var(--foreground); } .ws-menu__clear svg { width: 12px; height: 12px; } .ws-menu__list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px; } .ws-menu__empty { padding: 10px 8px; color: var(--faint); font-size: var(--fs-sm); } .ws-menu__item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 0 8px; border-radius: var(--radius-sm); font-size: var(--fs-sm); text-align: left; color: var(--secondary-foreground); } .ws-menu__item:hover, .ws-menu__item:focus-visible, .ws-menu__item:focus { background: var(--surface-2); color: var(--foreground); outline: none; } .ws-menu__item.is-active { color: var(--foreground); font-weight: 600; } .ws-menu__item svg { flex: none; width: 14px; height: 14px; color: var(--faint); } .ws-menu__item.is-active svg { color: var(--primary); } .ws-menu__name { flex: 1; min-width: 0; } .ws-menu__count { flex: none; font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--faint); } /* tree toolbar:搜索 + +新建 + 折叠全部(无派发、无连接点) */ .tree-toolbar { display: flex; align-items: center; gap: 4px; } .tree-search { flex: 1; min-width: 0; height: 28px; min-height: 28px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--surface-1); color: var(--foreground); font-size: var(--fs-xs); appearance: none; transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out); } .tree-search::-webkit-search-cancel-button { appearance: none; } .tree-search::placeholder { color: var(--faint); } .tree-search:hover { border-color: var(--border-subtle); } .tree-search:focus { background: var(--card); border-color: var(--ring); outline: none; } .tree-toolbar .icon-btn { flex: none; width: 28px; height: 28px; } .tree-close { display: none; } .pane-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 6px 18px; } .tree { list-style: none; margin: 0; padding: 0; } .tree--sessions > li + li { margin-top: 2px; } /* 层级只由缩进表达:设计禁止竖引导线。 */ .tree ul { list-style: none; margin: 0; padding-left: 12px; } /* 被过滤器/活跃镜头挡住的会话数(点击切到「全部」) */ .tree-hidden { display: flex; align-items: center; gap: 5px; width: 100%; min-height: 26px; margin-top: 4px; padding: 0 6px; border-radius: var(--radius-sm); color: var(--faint); font-size: var(--fs-2xs); text-align: left; } .tree-hidden:hover { background: var(--surface-1); color: var(--muted-foreground); } .tree-hidden svg { flex: none; width: 11px; height: 11px; } /* 行:单行 = 折叠箭头 + 主按钮(点 + 名称 + !N)+ 行操作「…」 pi2.nvim 的 :PiSessions 不做淡入淡出:hover / 选中态瞬时切换。 */ .tree-row { display: flex; align-items: center; gap: 2px; min-height: 32px; padding: 0; border-radius: var(--radius-sm); } .tree-row:hover { background: var(--surface-1); } .tree-row.selected, .tree-row.is-menu { background: var(--surface-2); } .tree-row__main { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; height: 32px; padding: 0 4px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--secondary-foreground); font-size: var(--fs-sm); text-align: left; } .tree-row__main:focus-visible { outline: none; box-shadow: var(--focus-ring); } .tree-row.selected .tree-row__main { color: var(--foreground); font-weight: 600; } .tree-row .t-name { flex: 1 1 auto; min-width: 0; } /* 没有名字的会话:pi2.nvim 的占位样式(comment 色 + 斜体),静止不动。 */ .tree-row .t-name.is-unnamed, .tree-row .t-name.is-generating { color: var(--faint); font-style: italic; } /* 自动命名中的 120ms 盲文 spinner:前缀占位,由 JS 驱动帧,CSS 不参与动画。 */ .tree-row .t-spinner { flex: none; width: 1ch; color: var(--faint); font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1; } .tree-row .t-attn { flex: none; font-size: var(--fs-2xs); font-weight: 600; color: var(--warn); } .tree-row[data-hidden="true"] .t-name { /* 插件策略隐藏:变淡但不低于正文对比度下限。 */ opacity: 0.85; } .tree-toggle { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 26px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--faint); } .tree-toggle svg { width: 13px; height: 13px; } .tree-toggle:hover { color: var(--foreground); background: var(--accent); } .tree-toggle.open svg { transform: rotate(90deg); } .tree-toggle.leaf { visibility: hidden; } /* 「…」只在 hover / 键盘焦点 / 菜单打开时出现(<1000 常显 .75)。 */ .tree-row .t-more { width: 22px; height: 22px; opacity: 0; } .tree-row:hover .t-more, .tree-row:focus-within .t-more, .tree-row.is-menu .t-more { opacity: 1; } /* 行操作 popover:挂在 body 上,避免被 .pane-scroll 裁切。 `.menu` (app.css) 已经给了 popover 外观;这里只覆盖定位(fixed + 内联坐标)。 */ .menu.tree-pop { position: fixed; top: 0; left: 0; right: auto; z-index: 80; min-width: 11.5rem; padding: 4px; } .tree-pop .menu__item { min-height: 34px; } .tree-pop .menu__item.is-danger { color: var(--destructive); } .tree-pop .menu__item.is-danger svg { color: var(--destructive); } .tree-pop .menu__item.is-danger:hover { background: color-mix(in oklch, var(--destructive) 12%, transparent); } /* 状态圆点:由 根节点上的单一全局时钟驱动(data-pi-blink-* 属性,见 app.css 与 blink.ts), 不再使用每个圆点独立的 CSS animation,避免相位漂移。当前会话的蓝色标记在 app.css 的 `.dot--current`(不按容器限定:流头圆点与列表行必须同色)。 */ /* 子会话 / 子代理行:更矮、更小、灰一档;状态只由圆点表达。 */ .tree-row--sub .tree-row__main { height: 30px; } .tree-row--sub .tree-toggle { height: 24px; } .tree-row--sub .t-name { font-size: var(--fs-xs); color: var(--muted-foreground); } .tree-row--sub .t-hidden { flex: none; margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--faint); } /* 正在查看的子代理:文字回到 foreground + 字重;父会话行仍是 selected。 */ .tree-row--sub.is-viewing { background: var(--surface-1); } .tree-row--sub .tree-row__main.is-viewing { color: var(--foreground); font-weight: 600; } .tree-row--sub .tree-row__main.is-viewing .t-name { color: var(--foreground); } /* ---------- center: stream ---------- */ .stream-pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--background); } .stream-head { flex: none; display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); min-height: 3.25rem; border-bottom: 1px solid var(--border); background: var(--background); min-width: 0; } .stream-title { display: flex; align-items: center; gap: var(--space-2); flex: 1 1 auto; min-width: 0; } @media (max-width: 839px) { /* the head keeps identity + chips; the status word is redundant there */ .stream-head .stream-status { display: none; } } .stream-name { font-weight: 620; font-size: 0.9375rem; } .stream-body { position: relative; flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; flex-direction: column; } .stream-blank { align-items: center; justify-content: center; padding: var(--space-6); } .stream-scroll { flex: 1 1 auto; overflow-y: auto; min-height: 0; min-width: 0; padding: var(--space-4) var(--space-4) 0; scrollbar-gutter: stable; } .stream-list > .empty { margin: auto 0; } .stream-empty { margin: auto; } .stream-status-row { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); max-width: 68rem; margin: 0 auto var(--space-2); } .stream-status, .stream-older { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 0.75rem; padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); } .stream-status--err { color: var(--err); flex-wrap: wrap; justify-content: center; } .stream-older:hover { background: var(--accent); color: var(--foreground); } .stream-end { height: var(--space-6); flex: none; } .stream-list { display: flex; flex-direction: column; width: 100%; margin: 0 auto; flex: 1 0 auto; } .stream-list--virtual { display: block; position: relative; flex: none; } .stream-list:not(.stream-list--virtual) > .stream-item { position: relative; } .stream-list--virtual > .stream-item { position: absolute; top: 0; left: 0; width: 100%; will-change: transform; } /* messages */ .msg { min-width: 0; } .msg__meta { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-1); font-size: 0.75rem; min-width: 0; } .msg__text { white-space: pre-wrap; overflow-wrap: anywhere; } .msg__time { font-size: 0.6875rem; } .who { display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; font-weight: 650; letter-spacing: 0.02em; } .who--user { color: var(--role-user); } .who--agent { color: var(--role-agent); } .who--err { color: var(--role-error); } .msg--user { border-left: 3px solid var(--role-user); padding-left: var(--space-3); } .msg__error { border-left: 3px solid var(--role-error); padding-left: var(--space-3); margin-top: var(--space-3); } .msg__error-meta { display: flex; align-items: center; gap: var(--space-2); font-size: 0.75rem; margin-bottom: var(--space-1); } .msg__images { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); } .msg__img { max-width: 12rem; max-height: 8rem; border-radius: var(--radius); border: 1px solid var(--border); object-fit: cover; } .msg__text.streaming::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--role-agent); animation: pulse 1s ease-in-out infinite; } /* thinking */ .thinking { display: flex; align-items: baseline; gap: var(--space-2); width: 100%; text-align: left; color: var(--muted-foreground); font-style: italic; font-size: 0.875rem; padding: 2px 0; margin: var(--space-1) 0; cursor: pointer; } .thinking__tag { display: inline-flex; align-items: center; gap: 4px; flex: none; font-style: normal; font-size: 0.75rem; color: var(--role-thinking); } .thinking__text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .thinking.open .thinking__text { white-space: pre-wrap; overflow: visible; text-overflow: clip; } /* todo block */ .todo { padding: var(--space-3); margin-top: var(--space-2); } .todo__head { display: flex; align-items: center; gap: var(--space-2); font-size: 0.8125rem; font-weight: 600; margin-bottom: var(--space-2); } .todo__head svg { color: var(--muted-foreground); } .todo__list { margin-top: var(--space-2); } .todo__row { display: flex; align-items: flex-start; gap: var(--space-2); padding: 2px 0; font-size: 0.875rem; } .todo__ico { flex: none; width: 1rem; text-align: center; line-height: 1.5; } .todo__ico--done { color: var(--ok); } .todo__ico--progress { color: var(--warn); display: inline-block; animation: spin 1.4s linear infinite; } .todo__ico--pending { color: var(--muted-foreground); } .todo__row.is-done .todo__txt { color: var(--muted-foreground); } .todo__row.is-active .todo__content { font-weight: 600; } .todo__active { display: block; font-size: 0.75rem; color: var(--warn); } .todo__more { margin-top: var(--space-1); } .todo__readonly { font-size: 0.6875rem; } /* batch block */ .batch { padding: var(--space-3); margin-top: var(--space-2); } .batch__head { gap: var(--space-2); font-size: 0.8125rem; font-weight: 600; } .batch__head svg { color: var(--muted-foreground); } .batch__list { margin-top: var(--space-2); } .batch__row { display: flex; align-items: center; gap: var(--space-2); padding: 1px 0; font-size: 0.875rem; border-radius: var(--radius-sm); } .batch__row:hover { background: var(--accent); } .batch__tree { flex: none; } .batch__ico { flex: none; width: 1rem; text-align: center; } .batch__ico--ok { color: var(--ok); } .batch__ico--err { color: var(--err); } .batch__ico--warn { color: var(--warn); animation: spin 1.4s linear infinite; display: inline-block; } .batch__ico--muted { color: var(--muted-foreground); } .batch__name { flex: 1; min-width: 0; } .batch__row.is-link { cursor: pointer; } /* floating stream buttons */ .stream-fab { position: absolute; right: var(--space-5); bottom: var(--space-3); z-index: 5; display: flex; gap: var(--space-2); pointer-events: none; } .stream-fab > button { pointer-events: auto; } .fab { display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-3); border: 1px solid var(--border); border-radius: 999px; background: var(--popover); color: var(--popover-foreground); font-size: 0.75rem; box-shadow: var(--shadow-sm); opacity: 0; pointer-events: none; transition: background 0.15s ease, opacity 0.2s ease; } .fab.is-visible { opacity: 1; pointer-events: auto; } .fab:hover { background: var(--accent); } /* ---------- composer ---------- */ .composer { position: sticky; bottom: 0; z-index: 5; flex: none; padding: var(--space-3) var(--space-4); background: var(--background); border-top: 1px solid var(--border); min-width: 0; } .composer__box { border: 1px solid var(--input); border-radius: var(--radius-lg); background: var(--card); padding: var(--space-2) var(--space-3); transition: border-color 0.15s ease, box-shadow 0.15s ease; } .composer__box:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 25%, transparent); } .composer__box.is-disabled { opacity: 0.75; } .composer__ta, .composer__ta:focus { display: block; width: 100%; border: 0; border-radius: 0; padding: 0; background: transparent; box-shadow: none; resize: none; overflow-y: hidden; line-height: 1.55; min-height: 1.5rem; max-height: 7.5rem; font-size: 0.9375rem; } .composer__bar { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-2); } .composer__sel { width: auto; max-width: 12rem; padding: 2px var(--space-2); font-size: 0.8125rem; } .composer__send { flex: none; } .composer__attachments { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-1); } .composer__att { display: inline-flex; align-items: center; gap: 4px; max-width: 16rem; padding: 2px var(--space-2); border-radius: var(--radius-sm); background: var(--secondary); font-size: 0.75rem; } .composer__att-img { width: 1.25rem; height: 1.25rem; border-radius: 3px; object-fit: cover; flex: none; } .composer__hint { display: flex; align-items: center; gap: var(--space-1); margin-top: var(--space-2); font-size: 0.75rem; color: var(--warn); } /* ---------- drawers(仅 <1000:会话树是抽屉) ---------- */ .drawer-backdrop { position: fixed; inset: 0; z-index: 54; background: var(--overlay); border: 0; padding: 0; opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) var(--ease-out); } .chat-page.tree-open .drawer-backdrop { opacity: 1; pointer-events: auto; } /* ≥1000:树是常驻栅格列,没有抽屉、没有遮罩、没有面板 */ @media (min-width: 1000px) { .drawer-backdrop { display: none; } } /* <1000:树 = 左抽屉(固定宽 + 遮罩 + 关闭按钮) */ @media (max-width: 999px) { .tree-pane { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: min(88vw, 20rem); z-index: 55; transform: translateX(-102%); visibility: hidden; transition: transform var(--dur) var(--ease-out), visibility 0s linear var(--dur); } .chat-page.tree-open .tree-pane { transform: none; visibility: visible; box-shadow: var(--shadow-lg); transition: transform var(--dur) var(--ease-out); } .tree-close { display: inline-flex; } /* 触摸环境下「…」常显,避免必须 hover 才能发现行操作。 */ .tree-row .t-more { opacity: 0.75; } .tree-row:hover .t-more, .tree-row:focus-within .t-more, .tree-row.is-menu .t-more { opacity: 1; } } /* <600:树行 44px 命中区;抽屉贴住视口底并吸收安全区(底部导航条已删除)。 */ @media (max-width: 599px) { .tree-pane { bottom: 0; padding-bottom: env(safe-area-inset-bottom); } .ws-switch { height: 40px; } .tree-toolbar .icon-btn, .tree-toggle, .tree-row .tree-toggle { width: 44px; height: 44px; } .tree-row, .tree-row--sub .tree-row__main { min-height: 44px; } .tree-row__main, .tree-row--sub .tree-row__main { height: 44px; } .tree-row .t-more { width: 44px; height: 44px; opacity: 0.75; } .tree-pop .menu__item { min-height: 44px; } .pane-scroll { padding: 6px 4px calc(14px + env(safe-area-inset-bottom)); } .stream-head { padding: var(--space-2) var(--space-3); } .composer { padding: var(--space-2) var(--space-3); } .composer__bar { flex-wrap: wrap; } .composer__sel { max-width: 45%; } .composer__send { margin-left: auto; } } /* touch targets */ @media (max-width: 839px) { .icon-btn { min-width: 2.5rem; min-height: 2.5rem; } .tool__head, .batch__row, .composer__sel, .fab { min-height: 2.5rem; } } /* ---------- attachment / dispatch ---------- */ .drop-zone { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-6) var(--space-4); text-align: center; border: 1px dashed var(--input); border-radius: var(--radius-lg); color: var(--muted-foreground); cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease; } .drop-zone:hover, .drop-zone.dragover { background: var(--accent); border-color: var(--ring); } .att-list { display: flex; flex-direction: column; gap: var(--space-1); } .att-file { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) 0; font-size: 0.8125rem; } .att-thumb { width: 2rem; height: 2rem; border-radius: var(--radius-sm); object-fit: cover; flex: none; border: 1px solid var(--border); } .check-row { display: flex; align-items: center; gap: var(--space-2); font-size: 0.875rem; cursor: pointer; } .check-row input { accent-color: var(--primary); width: 1rem; height: 1rem; } /* ---------- attention dialog ---------- */ .attn { display: flex; flex-direction: column; gap: var(--space-3); } .attn__q { font-size: 0.9375rem; } .attn__q code { background: var(--muted); padding: 0 4px; border-radius: var(--radius-sm); } .attn__options { display: flex; flex-wrap: wrap; gap: var(--space-2); } .attn__meta { font-size: 0.75rem; } .attn__countdown--urgent { color: var(--err); font-weight: 600; }