Files
plugins/packages/agent-console/web/src/styles/composer.css
T
qingnian108 08ad5e3956 page-agent-console 1.1.0: QA fixes, neutral accent, own dropdown menus, self-heal after a host restart, by qingnian108 (#569)
page-agent-console 1.1.0, by qingnian108 (#569).

QA fixes B1-B21, a reworked UI, a new logo, and self-heal after a plugin host restart. In this version:
- Accent: a fixed neutral grey (charcoal in light mode, light grey in dark mode). Magpie's accent tokens are dropped on purpose. Surfaces, text, lines, fonts and semantic colours still follow magpie.
- Every native <select> (composer effort/mode/Cursor fast, Settings, Debug) is now the page's own SelectMenu, a button plus a listbox.
- The registry summary again discloses the 127.0.0.1 service and its lifecycle, that only its own page gets the token, the ~46 MB first install, and that Claude Code isn't bundled (en, zh).
- session.js is written once at bind with beat:false, and beats every 4s only after the first /open. A new host deletes a dead host's session.js at startup (owner pid in session-owner.json, outside the page folder).
- The daemon swallows console EPIPE after a hard host kill and handles a lifeline close once.

Run at 930c6e2 on macOS (mote, Node 22), in a fresh copy:
- npm ci, then npm run check (tsc daemon + web): ok
- npx vitest run: 46 files, 288 passed, 17 skipped
- npm run verify:build: app.js, app.css, index.html and daemon/dist/main.js(.map) rebuild byte-identical
- bun scripts/check.mjs agent-console: ok
- Playwright Chromium and WebKit, light and dark, sandbox HOME, page served under /_magpie/plugin/<id>/page with a stub bridge passing accent #ff0000:
  - accent: --accent and the primary button stay grey (rgb(38,38,38) light, rgb(229,229,229) dark); no <select> anywhere.
  - Settings menus: click opens the menu inside the window; ArrowDown+Enter picks, closes and refocuses the trigger; the pick persists through the daemon.
  - Esc closes the menu, not the dialog, and then closes the dialog. Clicking an option keeps the dialog open; a click outside closes the menu.
  - A host that was never opened writes beat:false and doesn't rewrite session.js. SIGKILL it, start a new host: the stale file is removed and the page reaches the new daemon.
  - After an open, session.js beats. SIGKILL the host: the page heals in ~5.3s and stays. A daemon-only crash heals in ~5.3s.
  - Daemon logs: no uncaughtException or EPIPE, one lifeline line per daemon exit.
Not tried: the composer pickers in a browser (they need a thread with an installed agent; same SelectMenu component), magpie's real sandboxed frame, Windows and Linux.
2026-11-01 00:37:07 +08:00

207 lines
8.9 KiB
CSS

/* Input area (§8.6 Composer) — option B: white card, 1px border, 14px radius, neutral grey focus ring */
.composer { flex: none; padding: 0 16px 16px; }
.cp-card {
width: 100%; max-width: var(--col); margin: 0 auto;
background: var(--bg); border-radius: 14px; border: 1px solid var(--cp-line);
padding: 12px 12px 8px 14px; box-shadow: 0 1px 2px rgb(0 0 0 / .04);
transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.cp-card:focus-within { border-color: var(--cp-focus); box-shadow: 0 0 0 3px var(--cp-ring), 0 1px 2px rgb(0 0 0 / .04); }
.cp-card.waiting { border-color: color-mix(in oklab, var(--warn) 45%, var(--bg)); }
.cp-card.danger { border-color: color-mix(in oklab, var(--danger) 40%, var(--bg)); }
.cp-danger {
max-width: var(--col); margin: 0 auto 6px; display: flex; align-items: center; gap: 6px;
color: var(--danger); font-size: var(--fs-s); padding: 0 2px;
}
.cp-hint { max-width: var(--col); margin: 6px auto 0; font-size: 11.5px; color: var(--meta); text-align: center; }
.att-note { padding: 6px 10px 0; color: var(--muted); font-size: var(--fs-s); }
.cp-ta-wrap { position: relative; }
.slash-pop {
position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 6px;
max-height: min(240px, 40vh); overflow: hidden; display: flex; flex-direction: column;
z-index: 20;
}
.slash-pop .ap-scroll { max-height: inherit; }
.slash-pop .slash-h {
padding: 4px 10px 2px; font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase;
letter-spacing: 0.04em;
}
.slash-pop .mi.slash-item {
height: auto; min-height: 28px; padding: 4px 10px; flex-direction: column; align-items: flex-start;
gap: 0;
}
.slash-pop .slash-name { font-weight: 500; }
.slash-pop .slash-desc { font-size: var(--fs-xs); color: var(--muted); line-height: 1.3; }
.slash-pop .slash-hint { font-size: var(--fs-xs); color: var(--muted); font-family: var(--mono, monospace); }
.slash-pop .mi.slash-item.sel { background: var(--surface-hover); }
.cp-ta {
width: 100%; border: 0; resize: none; background: none; outline: none; color: var(--text);
font-size: var(--fs-l); line-height: 22px; min-height: 34px; max-height: calc(22px * 12); overflow-y: auto;
display: block; padding: 0;
}
.cp-ta::placeholder { color: var(--meta); }
.cp-bar {
display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
margin: 4px 0 0 -6px; min-width: 0;
}
/* Pill controls: 26px, 7px radius, 12px text; the agent·model chip is filled, the others are icon + label */
.pill-wrap { position: relative; flex: 0 1 auto; min-width: 0; max-width: 100%; }
.pill {
position: relative; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px;
border-radius: 7px; background: none; color: var(--pill-fg, var(--muted)); border: 1px solid transparent;
font-size: var(--fs-s); max-width: min(240px, 100%); min-width: 0; white-space: nowrap; cursor: pointer;
transition: background var(--dur-1);
}
.pill:hover { background: var(--surface-hover); }
.pill svg { flex: none; }
.pill.chip { background: var(--chip-bg); border-color: var(--chip-line); padding: 0 8px 0 4px; gap: 6px; max-width: min(300px, 100%); }
.pill.chip:hover { background: var(--surface-hover); }
.chip-logo { border-radius: 5px; }
.chip-caret { color: var(--meta); }
.pill .p-a { font-weight: 500; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 0 auto; max-width: 120px; }
.pill .p-t { color: var(--meta); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 auto; }
.pill .p-t::before { content: "·"; margin-right: 5px; }
.ipill .ip-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ipill:focus-visible { outline: 2px solid color-mix(in oklab, var(--accent) 45%, var(--bg)); outline-offset: -1px; }
.ipill[aria-expanded="true"] { background: var(--surface-hover); }
.ipill.danger { color: var(--danger); }
.mode-menu { max-width: 300px; }
.cp-div { width: 1px; height: 14px; background: var(--line); margin: 0 4px; flex: none; }
.cp-bar > .ibtn { flex: none; }
.cp-attach { color: var(--pill-fg, var(--muted)); }
/* When the composer gets narrow (depends on the middle column's width, not the window) */
.cp-card { container-type: inline-size; container-name: composer; }
@container composer (max-width: 520px) {
.pill .p-t { display: none; }
.pill { max-width: min(160px, 100%); }
.ipill .ip-l { max-width: 64px; }
}
@container composer (max-width: 380px) {
.pill { max-width: min(120px, 100%); padding: 0 6px; }
.ipill .ip-l { display: none; }
}
/* Agent·model popover */
.pop {
position: absolute; bottom: 32px; left: 0; z-index: 55; width: 260px;
background: var(--bg); border-radius: var(--r-m); box-shadow: var(--shadow-pop);
padding: 4px; max-height: 60vh; overflow-y: auto;
}
.agent-picker {
width: min(300px, calc(100vw - 32px)); padding: 0; overflow: hidden;
display: flex; flex-direction: column; max-height: min(420px, 60vh);
}
.agent-picker .ap-search {
display: flex; align-items: center; gap: 8px; padding: 8px 10px;
border-bottom: 1px solid var(--line); flex: none; color: var(--muted);
}
.agent-picker .ap-search-in {
flex: 1; min-width: 0; border: 0; background: none; outline: none;
font-size: var(--fs-s); color: var(--fg);
}
.agent-picker .ap-search-in::placeholder { color: var(--muted); }
.agent-picker .ap-scroll {
overflow-y: auto; padding: 4px; flex: 1; min-height: 0;
}
.agent-picker .ap-empty {
padding: 12px 10px; font-size: var(--fs-s); color: var(--muted); text-align: center;
}
.agent-picker .ap-back {
font-weight: 600; margin-bottom: 2px;
}
.agent-picker .ap-back-icon {
display: inline-flex; transform: rotate(180deg); margin-right: 2px;
}
.agent-picker .mi-row {
display: flex; align-items: center; gap: 6px; width: 100%; text-align: left;
}
/* Provider list: name on the left, meta on the right, so tags like "Experimental" don't squeeze out the name */
.agent-picker .provider-pick-row {
justify-content: space-between;
gap: 8px;
}
.agent-picker .provider-pick-name {
flex: 0 1 auto;
min-width: 5.5rem;
max-width: 58%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: 500;
color: inherit;
}
.agent-picker .provider-pick-meta {
flex: 0 0 auto;
display: inline-flex;
align-items: center;
justify-content: flex-end;
gap: 6px;
min-width: 0;
margin-left: auto;
}
.agent-picker .provider-pick-meta .dlg-hint {
flex: none;
font-size: 10px;
max-width: 5rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Model search rows still use mi-name / mi-sub */
.agent-picker .mi-row .mi-name {
flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.agent-picker .mi-row .mi-sub {
flex: none; max-width: 38%; font-size: 11px; color: var(--muted);
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.agent-picker .model-pick-row {
min-width: 0;
}
.agent-picker .model-pick-name {
flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.agent-picker .model-pick-default {
flex: 0 1 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.agent-picker .mi-meta { flex: none; font-size: 11px; color: var(--muted); white-space: nowrap; }
.agent-picker .mi-tag { flex: none; font-size: 10px; color: var(--accent); }
.agent-picker .mi-caret { flex: none; color: var(--muted); display: inline-flex; }
.agent-picker .mi-check { flex: none; margin-left: auto; color: var(--accent); }
.ap-sec { padding: 4px 0; }
.ap-sec .tinput { height: 26px; margin-bottom: 4px; }
.ap-sec .mi { height: 26px; font-size: var(--fs-s); }
/* Attachment strip */
.att-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 6px; }
.att {
display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px;
background: var(--surface-hover); border-radius: var(--r-s); font-size: var(--fs-s);
}
.att img { width: 22px; height: 22px; object-fit: cover; border-radius: 4px; }
.att.up { opacity: .6; }
.att-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-x { color: var(--muted); font-size: 14px; line-height: 1; }
.att-x:hover { color: var(--fg); }
.cp-right { margin-left: auto; flex: none; display: flex; align-items: center; gap: 8px; }
.cp-clock { font-size: var(--fs-s); color: var(--meta); font-variant-numeric: tabular-nums; }
.cp-send, .cp-stop {
width: 30px; height: 30px; border-radius: 50%; flex: none;
display: inline-flex; align-items: center; justify-content: center;
transition: filter var(--dur-1), opacity var(--dur-1);
}
.cp-send { background: var(--accent); color: var(--accent-fg); }
.cp-send:hover { filter: brightness(1.08); }
.cp-send[disabled] { opacity: .35; cursor: default; filter: none; }
.cp-stop { background: var(--fg); color: var(--bg); }
.cp-stop:hover { filter: brightness(1.15); }
@media (max-width: 560px) {
.composer { padding: 0 10px 10px; }
}