agent-console 1.3.3: reconnect on return, sidebar dots, permission-wait, chat icon (#760)

qingnian108's follow-up to #747 and #758, on top of 1.3.2.

- A permission request still open when its turn ends is cancelled by the
  daemon (manager and ACP session both), and an ACP request the Agent
  withdraws ($/cancel_request, through the handler's AbortSignal) closes
  as cancelled. The page waits only on cards that still show buttons, so
  a finished turn no longer leaves 等待授权 with nothing to click. The
  等待授权 pill scrolls to the waiting card.
- 添加到对话 uses a speech-bubble icon.
- Sidebar dot: blinks while running, green after a completed turn, red
  on failure, amber while waiting.
- Wrapper: every disconnect / invalid-link end state offers Reconnect;
  the last safe back URL is kept in sessionStorage (safeBack re-checked
  on read). Coming back to the page (visible / focus) probes the child
  for 4 s instead of waiting out timers pushed back while hidden.

Review (head 0c8ee32b): every changed source line read. 1.3.2's Codex
model_catalog_json change is kept (codex/provider.ts untouched, rebuilt
dist still carries it). No new network in tests, page text set through
textContent/React, no new timers in the page or daemon; the wrapper's
sessionStorage back passes the same loopback check (tested with an evil
stored value).

Run (mote, macOS), standalone copy of packages/agent-console:
- npm ci; npm run check OK.
- vitest: 65 files, 489 passed / 17 skipped.
- npm run build, then verify:build: committed app/ and daemon/dist
  identical to the rebuild.
On the PR merged onto main 5026f636: root `bun test
packages/agent-console` 6/6, `bun scripts/check.mjs` exit 0.

Not tried: scripts/e2e-v1.mjs (Playwright, scenario 28), the page with a
live Cursor/Claude/Codex, Windows/Linux.
This commit is contained in:
qingnian108
2026-11-05 18:14:53 +08:00
committed by GitHub
parent 5026f6362e
commit 41e90a18d3
30 changed files with 870 additions and 131 deletions
@@ -28,6 +28,8 @@ const PATHS: Record<string, string> = {
stopFill: "M8 8h8v8H8z",
shield: "M12 3l8 3v6c0 5-3.5 9-8 11-4.5-2-8-6-8-11V6l8-3z",
quote: "M5 7h5v5H7c0 2 1 3 3 4M14 7h5v5h-3c0 2 1 3 3 4",
// 添加到对话 (selection pop-up): speech bubble + three dots
chat: "M5 5h14v10H9l-4 4V5zM9 10h.01M12 10h.01M15 10h.01",
pencil: "M4 20h4L19 9a2.1 2.1 0 0 0-3-3L5 17v3zM14 7l3 3",
shieldCheck: "M12 3l8 3v6c0 5-3.5 9-8 11-4.5-2-8-6-8-11V6l8-3zM8.5 12.2l2.4 2.4 4.6-4.8",
zap: "M13 2L4 14h7l-1 8 9-12h-7l1-8z",
@@ -124,7 +124,7 @@ export function QuoteSelect() {
onPointerDown={(e) => e.preventDefault()}
onClick={add}
>
<Icon name="quote" size={13} />
<Icon name="chat" size={13} />
<span>{t("quote.add")}</span>
</button>,
document.body,
@@ -6,6 +6,7 @@ import { useUi } from "../stores/ui";
import { ws } from "../main";
import type { Project, ThreadMeta } from "../types/models";
import { relTime } from "../util/format";
import { threadDotClass } from "../util/threadDot";
import { Menu, useMenu, type MenuItem } from "./Menu";
import { Dialog, ConfirmDialog } from "./Dialog";
import { Icon } from "./Icons";
@@ -14,12 +15,7 @@ import { displayThreadTitle, errMsg, t as tr, tf } from "../i18n/index.js";
const THREAD_PAGE = 10;
function dotClass(t: ThreadMeta, pendingIds: Set<string>): string {
if (pendingIds.has(t.id)) return "dot wait";
if (t.status === "running" || t.status === "initializing") return "dot run";
if (t.status === "error" || t.lastTurnStatus === "failed") return "dot err";
return "dot";
}
const dotClass = threadDotClass;
export function Sidebar({ pendingByThread }: { pendingByThread: Set<string> }) {
const { projects, threads } = useData();
@@ -25,7 +25,7 @@ function useNow(running: boolean): number {
return now;
}
export function Topbar({ pendingCount }: { pendingCount: number }) {
export function Topbar({ pendingCount, pendingKey }: { pendingCount: number; pendingKey?: string }) {
const { projects, threads } = useData();
const ui = useUi();
const { version } = useConnection();
@@ -101,7 +101,11 @@ export function Topbar({ pendingCount }: { pendingCount: number }) {
) : (
<span className="tb-title ghost">{project ? t("topbar.pickThread") : t("app.title")}</span>
)}
{pill && <span className={`tb-pill ${pill.cls}`}>{pill.cls === "run" && <span className="tb-pill-dot" />}{pill.text}</span>}
{pill && (pill.cls === "wait" && pendingKey
// 等待授权 brings the card that waits into view (it may be far up a long conversation)
? <button type="button" className={`tb-pill ${pill.cls}`} title={t("topbar.showRequest")}
onClick={() => window.dispatchEvent(new CustomEvent("ac-show-item", { detail: { key: pendingKey } }))}>{pill.text}</button>
: <span className={`tb-pill ${pill.cls}`}>{pill.cls === "run" && <span className="tb-pill-dot" />}{pill.text}</span>)}
<div className="tb-right">
{thread?.model && <span className="tb-model">{thread.model}</span>}
{panelBtns.map((b) => (