Skip to content

Commit 83483f5

Browse files
于晓彤claude
andcommitted
fix(ui+refiner): 7 user-reported issues — rail/task/model-picker/canvas/refiner
UI fixes: - anomalyco#15 Remove the gear-icon "Tweaks" popover (theme + collapse) — user reported it as useless chrome. Theme falls back to saved pref / system, rail collapse stays on the rail's own chevron toggle. - anomalyco#7 Task names now follow each session's title (auto-generated or user- renamed). Root cause: `newWorkflowTask` was pre-setting `title: "Workflow"` on session.create, which blocked the backend's title agent from auto-generating (the agent only fires when title matches the default ISO placeholder). New sessions now leave title unset → ensureTitle fires → each task gets a distinct name. Rail and Tasks drawer show "Untitled" for sessions that still have the default placeholder; node-tab labels prefer the bound child session's title. - Rail's sub-task list capped at 8 visible rows with internal scroll (was squeezing all tasks into the visible rail height). - anomalyco#14 Per-slave model picker: clear `local.model` before opening the picker so picking the SAME model as master still routes (previously the on(key) effect required a key change to fire, so same-model picks silently no-op'd — the user's "选其他不生效" complaint). - anomalyco#10 Canvas bottom-half occluded: `.wf-canvas-host` was `position: relative` only, so its `flex: 1` child `.wf-r2-canvas` had no flex parent to grow into. Made the host a flex column so the canvas actually fills its allotted height. - anomalyco#11 React production error anomalyco#409 fixed by un-nesting the drill-in button: the outer node card was a `<button>` wrapping an inner drill-in `<button>` — invalid HTML that React surfaces as anomalyco#409. Switched the outer to `div role="button"` with Enter/Space handling. Refiner: - anomalyco#13 Refiner no longer observes user messages addressed to the orchestrator agent (workflow planning commands aren't generalisable experiences). Gate added in `extractUserMessage`. - anomalyco#5 Archived experiences are now discoverable: new "已归档 (N)" chip in the Knowledge substrip when N > 0, toggles `includeArchived`. Archived rows already had an "Unarchive" button in the card menu — this just makes finding them obvious. Co-Authored-By: Claude Opus 4.7 <[email protected]>
1 parent 55c4f60 commit 83483f5

10 files changed

Lines changed: 248 additions & 200 deletions

File tree

‎packages/app/src/app.tsx‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,13 @@ function WorkflowScreen() {
413413
directory: dir,
414414
throwOnError: true,
415415
})
416-
.session.create({
417-
title: title || "Workflow",
418-
})
416+
// Only pin the session title when the caller explicitly supplied one
417+
// (e.g. they typed something into the new-workflow form). Without an
418+
// explicit title, leave the session with its default ISO placeholder
419+
// so the backend's title agent kicks in on the first user message —
420+
// otherwise every workflow root session ends up named "Workflow"
421+
// and the rail's task list reads as identical rows (user's #7).
422+
.session.create(title ? { title } : {})
419423
.then((res) => res.data)
420424
.then(async (session) => {
421425
if (!session?.id) throw new Error("Failed to create root session")
@@ -425,7 +429,9 @@ function WorkflowScreen() {
425429
})
426430
await sdk.workflow.create({
427431
session_id: session.id,
428-
title: title || session.title || "Workflow",
432+
// Workflow object's title is separate from session.title — a
433+
// sensible default is fine here (canvas header reads it).
434+
title: title || "Workflow",
429435
})
430436
const snap = await sdk.workflow.session({
431437
sessionID: session.id,

‎packages/app/src/components/unified-shell/index.tsx‎

Lines changed: 6 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
* └──────┴──────────────────────────────────────────────────────────┘
1212
*
1313
* + TasksDrawer (right-edge overlay, click ⏃ in header to open)
14-
* + TweaksPanel (top-right gear, theme + rail collapse)
1514
*
1615
* The shell is route-agnostic: it accepts a `module` prop ("workflow" /
1716
* "knowledge" / "trace") and the page renders its own body via the
@@ -708,92 +707,6 @@ function TasksDrawer(props: {
708707
)
709708
}
710709

711-
/* ──────────────────────────────────────────────────────
712-
Tweaks Panel
713-
────────────────────────────────────────────────────── */
714-
715-
function TweaksPanel(props: {
716-
theme: ShellTheme
717-
collapsed: boolean
718-
onTheme: (t: ShellTheme) => void
719-
onCollapse: (v: boolean) => void
720-
}) {
721-
const [open, setOpen] = createSignal(false)
722-
let root: HTMLDivElement | undefined
723-
724-
onMount(() => {
725-
const handler = (e: MouseEvent) => {
726-
if (!root) return
727-
if (!root.contains(e.target as Node)) setOpen(false)
728-
}
729-
document.addEventListener("mousedown", handler)
730-
onCleanup(() => document.removeEventListener("mousedown", handler))
731-
})
732-
733-
return (
734-
<div ref={(el) => (root = el)}>
735-
<button
736-
type="button"
737-
class="rune-tweaks-trigger"
738-
onClick={() => setOpen((v) => !v)}
739-
title="Tweaks"
740-
aria-expanded={open() ? "true" : "false"}
741-
>
742-
<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4">
743-
<circle cx="8" cy="8" r="2.4" />
744-
<path d="M8 1v2.5M8 12.5V15M1 8h2.5M12.5 8H15M3 3l1.8 1.8M11.2 11.2L13 13M3 13l1.8-1.8M11.2 4.8L13 3" />
745-
</svg>
746-
</button>
747-
<Show when={open()}>
748-
<div class="rune-tweaks-pop" role="dialog" aria-label="Tweaks">
749-
<div class="rune-tweaks-row">
750-
<span class="rune-tweaks-label">Theme</span>
751-
<div class="rune-tweaks-segment">
752-
<button
753-
type="button"
754-
class="rune-tweaks-segment-btn"
755-
classList={{ "is-on": props.theme === "light" }}
756-
onClick={() => props.onTheme("light")}
757-
>
758-
Light
759-
</button>
760-
<button
761-
type="button"
762-
class="rune-tweaks-segment-btn"
763-
classList={{ "is-on": props.theme === "dark" }}
764-
onClick={() => props.onTheme("dark")}
765-
>
766-
Dark
767-
</button>
768-
</div>
769-
</div>
770-
<div class="rune-tweaks-row">
771-
<span class="rune-tweaks-label">Collapse rail</span>
772-
<div class="rune-tweaks-segment">
773-
<button
774-
type="button"
775-
class="rune-tweaks-segment-btn"
776-
classList={{ "is-on": !props.collapsed }}
777-
onClick={() => props.onCollapse(false)}
778-
>
779-
Off
780-
</button>
781-
<button
782-
type="button"
783-
class="rune-tweaks-segment-btn"
784-
classList={{ "is-on": props.collapsed }}
785-
onClick={() => props.onCollapse(true)}
786-
>
787-
On
788-
</button>
789-
</div>
790-
</div>
791-
</div>
792-
</Show>
793-
</div>
794-
)
795-
}
796-
797710
/* ──────────────────────────────────────────────────────
798711
StatusBar — bottom 28px row (design-spec)
799712
────────────────────────────────────────────────────── */
@@ -869,14 +782,15 @@ export function UnifiedShell(props: ShellProps) {
869782
const navigate = useNavigate()
870783
const params = useParams<{ dir: string; id: string }>()
871784

872-
const [theme, setTheme] = createSignal<ShellTheme>(readPref<ShellTheme>(THEME_KEY, "light"))
785+
// Theme + rail collapse: saved preference is still honoured, but the
786+
// manual toggles (formerly in a gear-icon "Tweaks" popover) were removed
787+
// — the popover had no clear use and added chrome. Theme defaults to
788+
// saved pref → "light"; rail collapse toggles via the chevron button
789+
// on the rail itself (no external trigger needed).
790+
const [theme] = createSignal<ShellTheme>(readPref<ShellTheme>(THEME_KEY, "light"))
873791
const [collapsed, setCollapsed] = createSignal<boolean>(readPref<string>(RAIL_KEY, "false") === "true")
874792
const [tasksOpen, setTasksOpen] = createSignal(false)
875793

876-
const updateTheme = (t: ShellTheme) => {
877-
setTheme(t)
878-
writePref(THEME_KEY, t)
879-
}
880794
const updateCollapsed = (v: boolean) => {
881795
setCollapsed(v)
882796
writePref(RAIL_KEY, v ? "true" : "false")
@@ -948,13 +862,6 @@ export function UnifiedShell(props: ShellProps) {
948862
onPick={props.onPickTask}
949863
onCreate={props.onCreateTask}
950864
/>
951-
952-
<TweaksPanel
953-
theme={theme()}
954-
collapsed={collapsed()}
955-
onTheme={updateTheme}
956-
onCollapse={updateCollapsed}
957-
/>
958865
</div>
959866
)
960867
}

‎packages/app/src/components/unified-shell/shell.css‎

Lines changed: 19 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* │ │ │
1515
* └─────┴─────────────────────────────────────────┘
1616
* + TasksDrawer (overlays from right edge)
17-
* + TweaksPanel (popover anchored to top-right gear)
1817
*
1918
* The `.rune-shell` element drives `display: grid` with the rail as the
2019
* left column and the rest stacked. Width of the rail collapses by data
@@ -353,6 +352,25 @@
353352
padding: 2px 0 var(--rune-u2) 18px;
354353
margin-left: 26px;
355354
border-left: 1px solid var(--rune-line-faint);
355+
/* Cap visible task rows so a long task list scrolls inside its own
356+
* module instead of pushing other modules / the brand block off
357+
* screen. ~8 rows (each row = 26px min-height + 2px gap) reads as
358+
* a comfortable preview before the scroll kicks in. The parent
359+
* `.rune-rail-group` still scrolls separately when all modules are
360+
* expanded at once. */
361+
max-height: calc(8 * 30px);
362+
overflow-y: auto;
363+
overflow-x: hidden;
364+
/* Slim scrollbar so it doesn't dominate the narrow rail column. */
365+
scrollbar-width: thin;
366+
scrollbar-gutter: stable;
367+
}
368+
.rune-shell .rune-rail-subs::-webkit-scrollbar {
369+
width: 6px;
370+
}
371+
.rune-shell .rune-rail-subs::-webkit-scrollbar-thumb {
372+
background: var(--rune-line);
373+
border-radius: 3px;
356374
}
357375
.rune-shell[data-rail="collapsed"] .rune-rail-subs { display: none; }
358376

@@ -894,80 +912,6 @@
894912
transition: width var(--rune-t-base);
895913
}
896914

897-
/* ─── Tweaks Panel ─── */
898-
/* The trigger now sits inline inside `.rune-head-actions` (same row as
899-
* Tasks). Previous design floated it `position: fixed` at 12/12 with a
900-
* 32px square — which placed it beside the 28px Tasks button but
901-
* couldn't share its height/baseline, so the two read as "stuck
902-
* together" with mismatched sizes. Inline + 28px height = proper
903-
* grouping. */
904-
.rune-shell .rune-tweaks-trigger {
905-
position: relative;
906-
width: 28px;
907-
height: 28px;
908-
display: grid;
909-
place-items: center;
910-
border: 1px solid var(--rune-line);
911-
border-radius: var(--rune-r);
912-
background: var(--rune-bg-raised);
913-
color: var(--rune-fg-mute);
914-
transition: background var(--rune-t-fast), color var(--rune-t-fast), border-color var(--rune-t-fast);
915-
}
916-
.rune-shell .rune-tweaks-trigger:hover {
917-
background: var(--rune-bg-surface);
918-
border-color: var(--rune-line-strong);
919-
color: var(--rune-fg);
920-
}
921-
.rune-shell .rune-tweaks-pop {
922-
position: absolute;
923-
top: calc(100% + 6px);
924-
right: 0;
925-
width: 280px;
926-
background: var(--rune-bg-raised);
927-
border: 1px solid var(--rune-line);
928-
border-radius: var(--rune-r-lg);
929-
box-shadow: var(--rune-shadow-lg);
930-
padding: var(--rune-u4);
931-
z-index: 75;
932-
display: flex;
933-
flex-direction: column;
934-
gap: var(--rune-u3);
935-
animation: rune-fade-up var(--rune-t-base) ease;
936-
}
937-
.rune-shell .rune-tweaks-row {
938-
display: flex;
939-
align-items: center;
940-
gap: var(--rune-u2);
941-
}
942-
.rune-shell .rune-tweaks-label {
943-
font-size: var(--rune-fs-sm);
944-
font-weight: 500;
945-
color: var(--rune-fg);
946-
flex: 1;
947-
}
948-
.rune-shell .rune-tweaks-segment {
949-
display: inline-flex;
950-
border: 1px solid var(--rune-line-faint);
951-
border-radius: var(--rune-r-sm);
952-
background: var(--rune-bg-inset);
953-
padding: 2px;
954-
height: 26px;
955-
}
956-
.rune-shell .rune-tweaks-segment-btn {
957-
padding: 0 10px;
958-
height: 22px;
959-
font-size: var(--rune-fs-xs);
960-
font-weight: 500;
961-
color: var(--rune-fg-mute);
962-
border-radius: 3px;
963-
transition: background var(--rune-t-fast), color var(--rune-t-fast);
964-
}
965-
.rune-shell .rune-tweaks-segment-btn.is-on {
966-
background: var(--rune-bg-raised);
967-
color: var(--rune-fg);
968-
box-shadow: var(--rune-shadow-sm);
969-
}
970-
971915
/* ─── Substrip search input — design-spec 200px field with leading icon. */
972916
.rune-shell .rune-search-input {
973917
display: flex;

‎packages/app/src/pages/session.tsx‎

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ import { extractPromptFromParts } from "@/utils/prompt"
7171
import { same } from "@/utils/same"
7272
import { formatServerError } from "@/utils/server-errors"
7373

74+
// Mirror of `Session.isDefaultTitle` in packages/opencode/src/session/session.ts:41
75+
// — fresh sessions get titled "Parent session - <ISO>" or "Child session - <ISO>"
76+
// before the title-agent fires. Treat those as "no real title yet" so callers
77+
// can fall back to a more useful display name.
78+
const DEFAULT_SESSION_TITLE_RE =
79+
/^(Parent session - |Child session - )\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/
80+
function isDefaultSessionTitle(title: string | undefined | null): boolean {
81+
return !!title && DEFAULT_SESSION_TITLE_RE.test(title)
82+
}
83+
7484
const emptyUserMessages: UserMessage[] = []
7585
type FollowupItem = FollowupDraft & { id: string }
7686
type FollowupEdit = Pick<FollowupItem, "id" | "prompt" | "context">
@@ -645,11 +655,22 @@ export default function Page() {
645655

646656
const newWorkflowTask = async () => {
647657
try {
648-
const session = await sdk.client.session.create({ title: "Workflow" }).then((res) => res.data)
658+
// Do NOT pass an explicit title here. The backend's title agent
659+
// (`SessionPrompt.ensureTitle`) only generates a title when the
660+
// current title matches the default `"Parent session - <ISO>"`
661+
// format — passing `"Workflow"` permanently locks every task to
662+
// that literal name (the user's #7 complaint: "全是同名task").
663+
// Leaving title unset lets the auto-title flow run on the first
664+
// user message, and the user can still rename via the session
665+
// settings if they want.
666+
const session = await sdk.client.session.create({}).then((res) => res.data)
649667
if (!session?.id) throw new Error("Failed to create root session")
650668
await sdk.client.workflow.create({
651669
session_id: session.id,
652-
title: session.title || "Workflow",
670+
// Workflow object's title is separate from session.title — keep
671+
// a sensible default here since it shows in the canvas header
672+
// until the orchestrator emits a real plan title.
673+
title: "Workflow",
653674
})
654675
const slug = params.dir ?? base64Encode(sdk.directory)
655676
setStore("workflow", "graph")
@@ -674,11 +695,14 @@ export default function Page() {
674695
void (async () => {
675696
try {
676697
const next = sdk.createClient({ directory: result, throwOnError: true })
677-
const session = await next.session.create({ title: "Workflow" }).then((res) => res.data)
698+
// See `newWorkflowTask` above — do NOT pre-set session.title,
699+
// it would block the title agent from auto-generating a per-task
700+
// title and lock every task to the same literal name.
701+
const session = await next.session.create({}).then((res) => res.data)
678702
if (!session?.id) throw new Error("Failed to create root session")
679703
await next.workflow.create({
680704
session_id: session.id,
681-
title: session.title || "Workflow",
705+
title: "Workflow",
682706
})
683707
setStore("workflow", "graph")
684708
local.agent.set("orchestrator")
@@ -2156,10 +2180,23 @@ export default function Page() {
21562180
...(snap ? [{ id: "events", name: "Events", count: snap?.events?.length }] : []),
21572181
...((params.id && store.workflowOpenTabs[params.id]) || []).map((t) => ({
21582182
id: `${t.kind}:${t.id}`,
2159-
// Distill the planner-emitted title before truncation so
2160-
// the substrip tab shows a clean task name instead of a
2161-
// raw "Plan · ## Goal …" prefix.
2162-
name: distillTitle(t.title, 18),
2183+
// Resolve the tab title from the bound child session whenever
2184+
// possible — `session.title` is auto-generated from the first
2185+
// user message and the user can rename it from the chat view,
2186+
// so following it makes opened-node tabs distinguishable. The
2187+
// planner-emitted node title is the fallback when the node
2188+
// hasn't been started yet (no session_id) or when the session
2189+
// is still on its default ISO-timestamp title.
2190+
name: (() => {
2191+
const snap = workflowSnapshot()
2192+
const node = snap?.nodes?.find((n) => n.id === t.id)
2193+
const sid = node?.session_id
2194+
const sess = sid
2195+
? (sync.data.session ?? []).find((s) => s.id === sid)
2196+
: undefined
2197+
const title = sess?.title && !isDefaultSessionTitle(sess.title) ? sess.title : t.title
2198+
return distillTitle(title || t.title, 18)
2199+
})(),
21632200
onClose: () => {
21642201
const sid = params.id
21652202
if (!sid) return
@@ -2234,7 +2271,12 @@ export default function Page() {
22342271
// "all tasks at a glance" overlay.
22352272
railSubs: rootSessions().map((s) => ({
22362273
id: s.id,
2237-
title: s.title || "Untitled",
2274+
// Show the real (auto-generated or user-renamed) title. Sessions
2275+
// start with a default "Parent session - <ISO>" placeholder
2276+
// until the title agent fires on the first user message; render
2277+
// those as "Untitled" so the rail isn't a wall of identical
2278+
// timestamps when several tasks are still warming up.
2279+
title: isDefaultSessionTitle(s.title) ? "Untitled" : (s.title || "Untitled"),
22382280
onDelete: () => void deleteWorkflowTask(s.id),
22392281
})),
22402282
activeSubId: params.id,
@@ -2244,7 +2286,7 @@ export default function Page() {
22442286
},
22452287
tasks: rootSessions().map((s) => ({
22462288
id: s.id,
2247-
title: s.title || "Untitled",
2289+
title: isDefaultSessionTitle(s.title) ? "Untitled" : (s.title || "Untitled"),
22482290
state: "idle" as const,
22492291
time: s.time?.updated
22502292
? new Date(s.time.updated).toLocaleTimeString([], {

0 commit comments

Comments
 (0)