You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/09/04 14:54:51 UTC
(maka) 01/01: fix(desktop): rebuild the workbar shell on TabList and one open/close control
This is an automated email from the ASF dual-hosted git repository.
Astro-Han pushed a commit to branch fix/desktop-workbar-tab-strip-on-tablist
in repository https://gitbox.apache.org/repos/asf/maka.git
commit 26a27ca82826aa4a73dead725adbb8e1958b3886
Author: AstroHan <le...@outlook.com>
AuthorDate: Fri Sep 4 22:54:36 2026 +0800
fix(desktop): rebuild the workbar shell on TabList and one open/close control
The right workbar drew its own tab strip: a hand-written `role="tablist"`
div of ghost `Button`s with a close `IconButton` beside each, dnd-kit drag
reorder, a context menu of move/close verbs, and a preview/pin state no
renderer code ever set. It read as a browser tab bar without being one, and
the strip's container had no `min-width: 0`, so at the panel's floor the
tabs spilled past the edge and pushed [+] and the collapse toggle off screen
instead of scrolling.
The strip is now Astryx's `TabList`. That settles what the hand-written one
could not decide:
- `Tab` renders `endContent` inside its own `<button>`, so a per-tab close
would nest a button in a button, and `TabList` warns when a `role=tablist`
strip's direct children are not tabs. Opening and closing therefore share
the `[+]` menu, which lists every registered tool and marks the open ones
with a checkmark — the row-end mark `Selector` documents as the house
convention, not a boxed checkbox, and with no shortcut column, since the
launcher below already lists every face with its own.
- Nothing reorders tabs any more, so the strip's order is the order the
faces were opened in, and dnd-kit leaves the dependency tree with it.
- The strip lives in a `min-width: 0` flex item and takes its height from
the titlebar clearance it stands in. `hasDivider` makes a strip taller
than the bare buttons beside it, so letting it set the height grew the bar
the moment the first face opened and shifted the whole panel under the
cursor.
Alongside the shell:
- The Task face is retired; its ledger is folded into Work Board separately.
The renderer's read path goes with it — the hook, `SessionTodoPanel` and
its stylesheet. `todo:read` and `querySessionTodo` stay: that is the
boundary Work Board will read through, and it carries its own projection
tests.
- Review carried `git-branch`, which read as "switch branch". The face lists
changed files and their diffs, so it carries `file-diff`.
- `WORKBAR_TOOL_DEFINITIONS` is now the only place a face's icon, shortcut
and order are written. The strip, the `[+]` menu and the launcher all read
it instead of keeping three hand-maintained lists in the surface.
- The panel's floor rises from 320 to 340, the width `astryx docs layout`
budgets for a detail panel and the point where five tabs stop fitting
(386px needed against 260px available).
The workbar story frame declares `--maka-plate-titlebar-clearance`, which
AppShell puts on the frame holding the plates. Without it the bar's grid row
collapsed and the strip floated mid-panel, so the story could not show the
shell it exists to pin.
Refs #2188
Generated-by: Claude Code
---
apps/desktop/package.json | 4 -
.../src/main/__tests__/workbar-model.test.ts | 12 +-
apps/desktop/src/renderer/app-shell-e2e-fixture.ts | 1 -
.../src/renderer/features/workbar/README.md | 16 +-
.../workbar/controller/use-workbar-controller.ts | 4 -
.../workbar/controller/use-workbar-layout-state.ts | 31 +-
.../features/workbar/model/workbar-layout.ts | 7 +-
.../features/workbar/model/workbar-tabs.ts | 150 +----
.../workbar/model/workbar-tool-definitions.ts | 21 +-
.../workbar/tools/tasks/use-session-todo.ts | 92 ---
.../renderer/features/workbar/ui/workbar-host.tsx | 16 -
.../features/workbar/ui/workbar-surface.tsx | 675 ++++++---------------
.../src/renderer/locales/conversation-copy.ts | 46 +-
apps/desktop/src/renderer/styles.css | 1 -
.../src/renderer/styles/session-todo-panel.css | 94 ---
apps/desktop/src/renderer/styles/workbar/shell.css | 125 +---
.../accessibility-runtime-surfaces.stories.tsx | 4 -
apps/desktop/stories/session-workbar.stories.tsx | 29 +-
package-lock.json | 59 --
.../ui/src/__tests__/session-todo-panel.test.tsx | 43 --
packages/ui/src/icons.tsx | 1 +
packages/ui/src/index.ts | 1 -
packages/ui/src/session-todo-panel.tsx | 90 ---
23 files changed, 243 insertions(+), 1279 deletions(-)
diff --git a/apps/desktop/package.json b/apps/desktop/package.json
index 8e0ce27338..63150792f9 100644
--- a/apps/desktop/package.json
+++ b/apps/desktop/package.json
@@ -73,8 +73,6 @@
"@astryxdesign/core": "0.5.2",
"@astryxdesign/theme-neutral": "0.5.2",
"@babel/parser": "7.29.7",
- "@dnd-kit/core": "^6.3.1",
- "@dnd-kit/sortable": "^10.0.0",
"@fontsource-variable/geist": "^5.3.0",
"@fontsource-variable/geist-mono": "^5.3.0",
"@maka/ui": "0.1.0",
@@ -102,8 +100,6 @@
"@ant-design/icons-svg",
"@astryxdesign/core",
"@astryxdesign/theme-neutral",
- "@dnd-kit/core",
- "@dnd-kit/sortable",
"@fontsource-variable/geist",
"@fontsource-variable/geist-mono",
"@maka/ui",
diff --git a/apps/desktop/src/main/__tests__/workbar-model.test.ts b/apps/desktop/src/main/__tests__/workbar-model.test.ts
index c60af2a802..92c971eb51 100644
--- a/apps/desktop/src/main/__tests__/workbar-model.test.ts
+++ b/apps/desktop/src/main/__tests__/workbar-model.test.ts
@@ -74,15 +74,15 @@ describe('Workbar topology', () => {
state = reduceWorkbarPanels(state, {
type: 'open',
placement: 'right',
- tab: { id: 'workbar:tasks', kind: 'tasks' },
+ tab: { id: 'workbar:work-board', kind: 'work-board' },
});
state = reduceWorkbarPanels(state, {
type: 'move-to-panel',
- tabId: 'workbar:tasks',
+ tabId: 'workbar:work-board',
target: 'bottom',
});
assert.deepEqual(state.right.tabs.map((tab) => tab.id), ['workbar:review']);
- assert.deepEqual(state.bottom.tabs.map((tab) => tab.id), ['workbar:tasks']);
+ assert.deepEqual(state.bottom.tabs.map((tab) => tab.id), ['workbar:work-board']);
assert.equal(state.focusedPanel, 'bottom');
});
@@ -109,7 +109,7 @@ describe('Workbar topology', () => {
state = reduceWorkbarLayout(state, {
type: 'open',
placement: 'bottom',
- tab: { id: 'workbar:tasks', kind: 'tasks' },
+ tab: { id: 'workbar:work-board', kind: 'work-board' },
});
assert.equal(state.bottomOpen, true);
state = reduceWorkbarLayout(state, {
@@ -121,7 +121,7 @@ describe('Workbar topology', () => {
state = reduceWorkbarLayout(state, {
type: 'close',
placement: 'bottom',
- tabIds: ['workbar:tasks'],
+ tabIds: ['workbar:work-board'],
});
assert.equal(state.bottomOpen, false);
});
@@ -138,7 +138,6 @@ describe('Workbar topology', () => {
ownerSessionId: 'session-a',
},
{ id: 'side-chat:panel-a', kind: 'side-chat', ordinal: 2 },
- { id: 'workbar:files', kind: 'files', preview: true },
]),
);
assert.deepEqual(persistableSessionWorkbarPanels(state).right.tabs, [
@@ -196,7 +195,6 @@ describe('Workbar topology', () => {
resourceRef: 'run:round-trip',
ownerSessionId: 'session-a',
},
- { id: 'workbar:files', kind: 'files', preview: true },
],
'workbar:review',
),
diff --git a/apps/desktop/src/renderer/app-shell-e2e-fixture.ts b/apps/desktop/src/renderer/app-shell-e2e-fixture.ts
index b37fc542e1..102b9e4ade 100644
--- a/apps/desktop/src/renderer/app-shell-e2e-fixture.ts
+++ b/apps/desktop/src/renderer/app-shell-e2e-fixture.ts
@@ -132,7 +132,6 @@ export function createAppShellE2eFixtureActions(options: {
if (
state.workbarTab === 'review' ||
state.workbarTab === 'terminal' ||
- state.workbarTab === 'tasks' ||
state.workbarTab === 'browser' ||
state.workbarTab === 'files' ||
state.workbarTab === 'inspector'
diff --git a/apps/desktop/src/renderer/features/workbar/README.md b/apps/desktop/src/renderer/features/workbar/README.md
index e8c6754ca2..85c141f985 100644
--- a/apps/desktop/src/renderer/features/workbar/README.md
+++ b/apps/desktop/src/renderer/features/workbar/README.md
@@ -52,12 +52,18 @@ remounted when the active session changes.
## Lifecycle invariants
-- Review, Tasks, Browser, Files and Inspector tabs are persisted globally.
-- Terminal and Side Chat tabs, preview state and resource metadata are
- transient.
+- Review, Work Board, Browser, Files and Inspector tabs are persisted globally.
+- Terminal and Side Chat tabs and their resource metadata are transient.
- `WORKBAR_TOOL_DEFINITIONS` is the authority for persistence, singleton
- behavior and default placement; storage and controller code consume it
- rather than maintaining parallel kind lists.
+ behavior, default placement, icon and shortcut; storage, controller and UI
+ code consume it rather than maintaining parallel kind lists.
+- A face is opened and closed only from the strip's `[+]` menu, which lists
+ every registered tool and marks the open ones. Tabs carry no close control:
+ `Tab` renders `endContent` inside its own `<button>`, so a per-tab close
+ would nest a button in a button. Tabs are never reordered, so the strip's
+ order is the order the faces were opened in.
+- How many Terminals or Side Chats exist is each face's own business; only a
+ deliberate open adds a tab.
- Closing or leaving the owner session stops Terminal resources.
- A Terminal start is tagged with its source generation. If it resolves after
a Session switch or controller disposal, the returned resource is stopped
diff --git a/apps/desktop/src/renderer/features/workbar/controller/use-workbar-controller.ts b/apps/desktop/src/renderer/features/workbar/controller/use-workbar-controller.ts
index 59662743ab..0d13c72b37 100644
--- a/apps/desktop/src/renderer/features/workbar/controller/use-workbar-controller.ts
+++ b/apps/desktop/src/renderer/features/workbar/controller/use-workbar-controller.ts
@@ -711,10 +711,6 @@ export function useWorkbarController(
onActivateTab: layout.activateWorkbarTab,
onCloseTab: closeTab,
onCloseTabs: closeTabs,
- onReorderTab: layout.reorderWorkbarTab,
- onMoveTab: layout.moveWorkbarTab,
- onMoveTabToPanel: layout.moveWorkbarTabToPanel,
- onPinTab: layout.pinWorkbarTab,
onOpenLauncher: (placement) => {
layout.openWorkbarLauncher(placement);
revealPlacement(placement);
diff --git a/apps/desktop/src/renderer/features/workbar/controller/use-workbar-layout-state.ts b/apps/desktop/src/renderer/features/workbar/controller/use-workbar-layout-state.ts
index af7b235da5..3baba4c179 100644
--- a/apps/desktop/src/renderer/features/workbar/controller/use-workbar-layout-state.ts
+++ b/apps/desktop/src/renderer/features/workbar/controller/use-workbar-layout-state.ts
@@ -118,17 +118,7 @@ export function useWorkbarLayoutState() {
(
kind: Exclude<SessionWorkbarTabKind, 'side-chat'>,
placement: SessionWorkbarPlacement = 'right',
- options: { preview?: boolean } = {},
- ) =>
- dispatch({
- type: 'open',
- placement,
- tab: {
- id: `workbar:${kind}`,
- kind,
- ...(options.preview ? { preview: true } : {}),
- },
- }),
+ ) => dispatch({ type: 'open', placement, tab: { id: `workbar:${kind}`, kind } }),
[],
);
const openDynamicWorkbarTab = useCallback(
@@ -151,19 +141,6 @@ export function useWorkbarLayoutState() {
dispatch({ type: 'close', placement, tabIds }),
[],
);
- const reorderWorkbarTab = useCallback(
- (placement: SessionWorkbarPlacement, tabId: string, targetTabId: string) =>
- dispatch({ type: 'reorder', placement, tabId, targetTabId }),
- [],
- );
- const moveWorkbarTab = useCallback(
- (
- placement: SessionWorkbarPlacement,
- tabId: string,
- direction: 'left' | 'right',
- ) => dispatch({ type: 'move', placement, tabId, direction }),
- [],
- );
const openWorkbarLauncher = useCallback(
(placement: SessionWorkbarPlacement = 'right') =>
dispatch({ type: 'open-launcher', placement }),
@@ -177,9 +154,6 @@ export function useWorkbarLayoutState() {
const titleWorkbarTab = useCallback((tabId: string, title: string) => {
dispatch({ type: 'title', tabId, title });
}, []);
- const pinWorkbarTab = useCallback((tabId: string) => {
- dispatch({ type: 'pin', tabId });
- }, []);
useEffect(() => {
const handle = window.setTimeout(() => {
@@ -241,11 +215,8 @@ export function useWorkbarLayoutState() {
activateWorkbarTab,
closeWorkbarTab,
closeWorkbarTabs,
- reorderWorkbarTab,
- moveWorkbarTab,
moveWorkbarTabToPanel,
titleWorkbarTab,
- pinWorkbarTab,
openWorkbarLauncher,
};
}
diff --git a/apps/desktop/src/renderer/features/workbar/model/workbar-layout.ts b/apps/desktop/src/renderer/features/workbar/model/workbar-layout.ts
index 75d112f40b..6a76eae80e 100644
--- a/apps/desktop/src/renderer/features/workbar/model/workbar-layout.ts
+++ b/apps/desktop/src/renderer/features/workbar/model/workbar-layout.ts
@@ -36,7 +36,12 @@ import {
* a reader who never dragged the handle sees the change.
*/
export const SESSION_WORKBAR_DEFAULT_WIDTH = 480;
-export const SESSION_WORKBAR_MIN_WIDTH = 320;
+/**
+ * 340 is the floor `astryx docs layout` gives a detail/inspector panel, and it
+ * is also where the strip stops fitting: five faces need 386px of tab and have
+ * 260px, so below this the strip is always scrolling.
+ */
+export const SESSION_WORKBAR_MIN_WIDTH = 340;
export const SESSION_WORKBAR_MAX_WIDTH = 600;
export const SESSION_BOTTOM_PANEL_DEFAULT_HEIGHT = 300;
export const SESSION_BOTTOM_PANEL_MIN_HEIGHT = 180;
diff --git a/apps/desktop/src/renderer/features/workbar/model/workbar-tabs.ts b/apps/desktop/src/renderer/features/workbar/model/workbar-tabs.ts
index 82df248c19..4693848fe0 100644
--- a/apps/desktop/src/renderer/features/workbar/model/workbar-tabs.ts
+++ b/apps/desktop/src/renderer/features/workbar/model/workbar-tabs.ts
@@ -23,7 +23,6 @@ import { isPersistedWorkbarTool } from './workbar-tool-definitions.js';
export type SessionWorkbarTabKind =
| 'review'
| 'terminal'
- | 'tasks'
| 'work-board'
| 'browser'
| 'files'
@@ -35,8 +34,6 @@ export interface SessionWorkbarTab {
kind: SessionWorkbarTabKind;
/** Transient display title for dynamic tabs. Never persisted. */
title?: string;
- /** Replaceable tab until the user pins or interacts with it. */
- preview?: boolean;
/** Stable creation number for repeated tab kinds such as Terminal and Side chat. */
ordinal?: number;
resourceRef?: string;
@@ -63,21 +60,8 @@ export type WorkbarPanelsAction =
| { type: 'open'; placement: SessionWorkbarPlacement; tab: SessionWorkbarTab }
| { type: 'activate'; placement: SessionWorkbarPlacement; tabId: string }
| { type: 'close'; placement: SessionWorkbarPlacement; tabIds: readonly string[] }
- | {
- type: 'reorder';
- placement: SessionWorkbarPlacement;
- tabId: string;
- targetTabId: string;
- }
- | {
- type: 'move';
- placement: SessionWorkbarPlacement;
- tabId: string;
- direction: 'left' | 'right';
- }
| { type: 'move-to-panel'; tabId: string; target: SessionWorkbarPlacement }
| { type: 'title'; tabId: string; title: string }
- | { type: 'pin'; tabId: string }
| { type: 'open-launcher'; placement: SessionWorkbarPlacement };
/** The single topology transition boundary used by the Workbar controller. */
@@ -92,26 +76,10 @@ export function reduceWorkbarPanels(
return activateSessionWorkbarPanelTab(state, action.placement, action.tabId);
case 'close':
return closeSessionWorkbarPanelTabs(state, action.placement, action.tabIds);
- case 'reorder':
- return reorderSessionWorkbarPanelTab(
- state,
- action.placement,
- action.tabId,
- action.targetTabId,
- );
- case 'move':
- return moveSessionWorkbarPanelTab(
- state,
- action.placement,
- action.tabId,
- action.direction,
- );
case 'move-to-panel':
return moveSessionWorkbarTabToPanel(state, action.tabId, action.target);
case 'title':
return titleSessionWorkbarPanelTab(state, action.tabId, action.title);
- case 'pin':
- return pinSessionWorkbarPanelTab(state, action.tabId);
case 'open-launcher':
return openSessionWorkbarPanelLauncher(state, action.placement);
}
@@ -133,7 +101,6 @@ export interface PersistedSessionWorkbarPanels {
const STATIC_TAB_IDS: Record<Exclude<SessionWorkbarTabKind, 'side-chat'>, string> = {
review: 'workbar:review',
terminal: 'workbar:terminal',
- tasks: 'workbar:tasks',
'work-board': 'workbar:work-board',
browser: 'workbar:browser',
files: 'workbar:files',
@@ -257,17 +224,6 @@ export function titleSessionWorkbarPanelTab(
);
}
-export function pinSessionWorkbarPanelTab(
- state: SessionWorkbarPanelsState,
- tabId: string,
-): SessionWorkbarPanelsState {
- const placement = findSessionWorkbarTabPlacement(state, tabId);
- if (!placement) return state;
- return updateSessionWorkbarPanel(state, placement, (panel) =>
- pinSessionWorkbarTab(panel, tabId),
- );
-}
-
export function openSessionWorkbarPanelLauncher(
state: SessionWorkbarPanelsState,
placement: SessionWorkbarPlacement,
@@ -301,30 +257,6 @@ export function closeSessionWorkbarPanelTabs(
return next;
}
-export function reorderSessionWorkbarPanelTab(
- state: SessionWorkbarPanelsState,
- placement: SessionWorkbarPlacement,
- tabId: string,
- targetTabId: string,
-): SessionWorkbarPanelsState {
- const next = updateSessionWorkbarPanel(state, placement, (panel) =>
- reorderSessionWorkbarTab(panel, tabId, targetTabId),
- );
- return next === state ? state : { ...next, focusedPanel: placement };
-}
-
-export function moveSessionWorkbarPanelTab(
- state: SessionWorkbarPanelsState,
- placement: SessionWorkbarPlacement,
- tabId: string,
- direction: 'left' | 'right',
-): SessionWorkbarPanelsState {
- const next = updateSessionWorkbarPanel(state, placement, (panel) =>
- moveSessionWorkbarTab(panel, tabId, direction),
- );
- return next === state ? state : { ...next, focusedPanel: placement };
-}
-
export function moveSessionWorkbarTabToPanel(
state: SessionWorkbarPanelsState,
tabId: string,
@@ -347,15 +279,7 @@ export function openSessionWorkbarTab(
): SessionWorkbarTabsState {
const existing = state.tabs.find((candidate) => candidate.id === tab.id);
if (existing) {
- const preview =
- existing.preview === true && tab.preview !== true
- ? false
- : existing.preview === true;
- const next = {
- ...existing,
- ...tab,
- ...(preview ? { preview: true } : { preview: false }),
- };
+ const next = { ...existing, ...tab };
return {
...state,
tabs: state.tabs.map((candidate) =>
@@ -369,18 +293,14 @@ export function openSessionWorkbarTab(
),
};
}
- const replaced = tab.preview
- ? state.tabs.find((candidate) => candidate.preview === true)
- : undefined;
- const base = replaced
- ? closeSessionWorkbarTab(state, replaced.id)
- : state;
+ // New faces land at the end of the strip. Nothing reorders them afterwards,
+ // so the strip's order is the order they were opened in.
return {
- tabs: [...base.tabs, tab],
+ tabs: [...state.tabs, tab],
activeTabId: tab.id,
launcherOpen: false,
activationHistory: recordSessionWorkbarActivation(
- sessionWorkbarActivationHistory(base),
+ sessionWorkbarActivationHistory(state),
tab.id,
),
};
@@ -428,19 +348,6 @@ export function titleSessionWorkbarTab(
return changed ? { ...state, tabs } : state;
}
-export function pinSessionWorkbarTab(
- state: SessionWorkbarTabsState,
- tabId: string,
-): SessionWorkbarTabsState {
- let changed = false;
- const tabs = state.tabs.map((tab) => {
- if (tab.id !== tabId || tab.preview !== true) return tab;
- changed = true;
- return { ...tab, preview: false };
- });
- return changed ? { ...state, tabs } : state;
-}
-
export function openSessionWorkbarLauncher(
state: SessionWorkbarTabsState,
): SessionWorkbarTabsState {
@@ -501,55 +408,11 @@ export function closeSessionWorkbarTabs(
};
}
-export function sessionWorkbarTabsExcept(
- state: SessionWorkbarTabsState,
- tabId: string,
-): SessionWorkbarTab[] {
- return state.tabs.filter((tab) => tab.id !== tabId);
-}
-
-export function sessionWorkbarTabsToRight(
- state: SessionWorkbarTabsState,
- tabId: string,
-): SessionWorkbarTab[] {
- const index = state.tabs.findIndex((tab) => tab.id === tabId);
- return index < 0 ? [] : state.tabs.slice(index + 1);
-}
-
-export function reorderSessionWorkbarTab(
- state: SessionWorkbarTabsState,
- tabId: string,
- targetTabId: string,
-): SessionWorkbarTabsState {
- const sourceIndex = state.tabs.findIndex((tab) => tab.id === tabId);
- const targetIndex = state.tabs.findIndex((tab) => tab.id === targetTabId);
- if (sourceIndex < 0 || targetIndex < 0 || sourceIndex === targetIndex) {
- return state;
- }
- const tabs = [...state.tabs];
- const [tab] = tabs.splice(sourceIndex, 1);
- if (!tab) return state;
- tabs.splice(targetIndex, 0, tab);
- return { ...state, tabs };
-}
-
-export function moveSessionWorkbarTab(
- state: SessionWorkbarTabsState,
- tabId: string,
- direction: 'left' | 'right',
-): SessionWorkbarTabsState {
- const index = state.tabs.findIndex((tab) => tab.id === tabId);
- if (index < 0) return state;
- const targetIndex = direction === 'left' ? index - 1 : index + 1;
- const target = state.tabs[targetIndex];
- return target ? reorderSessionWorkbarTab(state, tabId, target.id) : state;
-}
-
export function persistableSessionWorkbarTabs(
state: SessionWorkbarTabsState,
): PersistedSessionWorkbarTabs {
const tabs = state.tabs
- .filter((tab) => isPersistedWorkbarTool(tab.kind) && tab.preview !== true)
+ .filter((tab) => isPersistedWorkbarTool(tab.kind))
.map(({ id, kind }) => ({ id, kind }));
return {
version: 2,
@@ -617,7 +480,6 @@ export function isSessionWorkbarTabKind(value: unknown): value is SessionWorkbar
return (
value === 'review' ||
value === 'terminal' ||
- value === 'tasks' ||
value === 'work-board' ||
value === 'browser' ||
value === 'files' ||
diff --git a/apps/desktop/src/renderer/features/workbar/model/workbar-tool-definitions.ts b/apps/desktop/src/renderer/features/workbar/model/workbar-tool-definitions.ts
index 09de048b1f..2789b55577 100644
--- a/apps/desktop/src/renderer/features/workbar/model/workbar-tool-definitions.ts
+++ b/apps/desktop/src/renderer/features/workbar/model/workbar-tool-definitions.ts
@@ -27,8 +27,8 @@ export interface WorkbarToolDefinition {
readonly labelKey: SessionWorkbarTabKind;
readonly icon:
| 'activity'
+ | 'file-diff'
| 'folder'
- | 'git-branch'
| 'globe'
| 'list-todo'
| 'message-circle-question'
@@ -58,7 +58,9 @@ const WORKBAR_TOOL_DEFINITION_BY_KIND = {
review: {
kind: 'review',
labelKey: 'review',
- icon: 'git-branch',
+ // The face lists changed files and their diffs, so it carries the diff
+ // glyph. `git-branch` read as "switch branch", which the face never does.
+ icon: 'file-diff',
shortcut: 'ctrl+shift+g',
persisted: true,
singleton: true,
@@ -91,14 +93,6 @@ const WORKBAR_TOOL_DEFINITION_BY_KIND = {
singleton: true,
defaultPlacement: 'right',
},
- tasks: {
- kind: 'tasks',
- labelKey: 'tasks',
- icon: 'list-todo',
- persisted: true,
- singleton: true,
- defaultPlacement: 'right',
- },
'work-board': {
kind: 'work-board',
labelKey: 'work-board',
@@ -120,7 +114,12 @@ const WORKBAR_TOOL_DEFINITION_BY_KIND = {
export type RegisteredWorkbarToolDefinition =
(typeof WORKBAR_TOOL_DEFINITION_BY_KIND)[SessionWorkbarTabKind];
-export const WORKBAR_TOOL_DEFINITIONS: readonly RegisteredWorkbarToolDefinition[] =
+/**
+ * Registry order is the order the launcher and the [+] menu list the faces in.
+ * Typed as the declared shape rather than the const union so a reader can ask
+ * every entry for its optional `shortcut`.
+ */
+export const WORKBAR_TOOL_DEFINITIONS: readonly WorkbarToolDefinition[] =
Object.values(WORKBAR_TOOL_DEFINITION_BY_KIND);
export function workbarToolDefinition(
diff --git a/apps/desktop/src/renderer/features/workbar/tools/tasks/use-session-todo.ts b/apps/desktop/src/renderer/features/workbar/tools/tasks/use-session-todo.ts
deleted file mode 100644
index fd2dc7d7df..0000000000
--- a/apps/desktop/src/renderer/features/workbar/tools/tasks/use-session-todo.ts
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { useCallback, useEffect, useRef, useState } from 'react';
-import { generalizedErrorMessage, generalizedErrorMessageChinese } from '@maka/core/redaction';
-import type { SessionTodoItem } from '@maka/core/session-todo';
-import type { UiLocale } from '@maka/ui';
-import { useWorkbarServices } from '../../services-context.js';
-
-interface SessionTodoView {
- sessionId?: string;
- items: SessionTodoItem[];
- loading: boolean;
- error?: string;
-}
-
-const EMPTY: SessionTodoView = { items: [], loading: false };
-
-export function useSessionTodo(
- sessionId: string | undefined,
- copy: { locale: UiLocale; loadFailed: string },
-): SessionTodoView & { retry: () => void } {
- const { todo } = useWorkbarServices();
- const generation = useRef(0);
- const [snapshot, setSnapshot] = useState<SessionTodoView>(EMPTY);
-
- const load = useCallback((targetSessionId: string, preserve: boolean) => {
- const requestGeneration = ++generation.current;
- setSnapshot((current) => ({
- sessionId: targetSessionId,
- items: preserve && current.sessionId === targetSessionId ? current.items : [],
- loading: true,
- }));
- void todo.read(targetSessionId).then(
- (items) => {
- if (requestGeneration !== generation.current) return;
- setSnapshot({ sessionId: targetSessionId, items, loading: false });
- },
- (error: unknown) => {
- if (requestGeneration !== generation.current) return;
- setSnapshot((current) => ({
- sessionId: targetSessionId,
- items: current.sessionId === targetSessionId ? current.items : [],
- loading: false,
- error:
- copy.locale === 'zh'
- ? generalizedErrorMessageChinese(error, copy.loadFailed)
- : generalizedErrorMessage(error, copy.loadFailed),
- }));
- },
- );
- }, [copy.loadFailed, copy.locale, todo]);
-
- useEffect(() => {
- generation.current += 1;
- if (!sessionId) {
- setSnapshot(EMPTY);
- return;
- }
- const unsubscribe = todo.subscribeChanges((event) => {
- if (event.sessionId === sessionId) load(sessionId, true);
- });
- load(sessionId, false);
- return () => {
- generation.current += 1;
- unsubscribe();
- };
- }, [load, sessionId, todo]);
-
- const retry = useCallback(() => {
- if (sessionId) load(sessionId, true);
- }, [load, sessionId]);
-
- if (snapshot.sessionId !== sessionId) return { ...EMPTY, loading: Boolean(sessionId), retry };
- return { ...snapshot, retry };
-}
diff --git a/apps/desktop/src/renderer/features/workbar/ui/workbar-host.tsx b/apps/desktop/src/renderer/features/workbar/ui/workbar-host.tsx
index d0cf65016e..08af527931 100644
--- a/apps/desktop/src/renderer/features/workbar/ui/workbar-host.tsx
+++ b/apps/desktop/src/renderer/features/workbar/ui/workbar-host.tsx
@@ -94,18 +94,6 @@ export interface WorkbarHostModel {
placement: SessionWorkbarPlacement,
tabs: readonly SessionWorkbarTab[],
) => void;
- onReorderTab: (
- placement: SessionWorkbarPlacement,
- tabId: string,
- targetTabId: string,
- ) => void;
- onMoveTab: (
- placement: SessionWorkbarPlacement,
- tabId: string,
- direction: 'left' | 'right',
- ) => void;
- onMoveTabToPanel: (tabId: string, target: SessionWorkbarPlacement) => void;
- onPinTab: (tabId: string) => void;
onOpenLauncher: (placement: SessionWorkbarPlacement) => void;
onRequestOpenTab: (
placement: SessionWorkbarPlacement,
@@ -191,10 +179,6 @@ export function WorkbarHost({ model: props }: { model: WorkbarHostModel }) {
onActivateTab={props.onActivateTab}
onCloseTab={props.onCloseTab}
onCloseTabs={props.onCloseTabs}
- onReorderTab={props.onReorderTab}
- onMoveTab={props.onMoveTab}
- onMoveTabToPanel={props.onMoveTabToPanel}
- onPinTab={props.onPinTab}
onOpenLauncher={props.onOpenLauncher}
onRequestOpenTab={props.onRequestOpenTab}
quotes={props.quotes}
diff --git a/apps/desktop/src/renderer/features/workbar/ui/workbar-surface.tsx b/apps/desktop/src/renderer/features/workbar/ui/workbar-surface.tsx
index 43ee14343f..d6e454fbaf 100644
--- a/apps/desktop/src/renderer/features/workbar/ui/workbar-surface.tsx
+++ b/apps/desktop/src/renderer/features/workbar/ui/workbar-surface.tsx
@@ -17,63 +17,34 @@
* under the License.
*/
-import {
- lazy,
- Suspense,
- useEffect,
- useRef,
- useState,
- type CSSProperties,
- type ComponentProps,
- type KeyboardEvent as ReactKeyboardEvent,
- type ReactNode,
-} from 'react';
-import {
- closestCenter,
- DndContext,
- PointerSensor,
- useSensor,
- useSensors,
- type DragEndEvent,
-} from '@dnd-kit/core';
-import {
- horizontalListSortingStrategy,
- SortableContext,
- useSortable,
-} from '@dnd-kit/sortable';
-import {
- SessionTodoPanel,
- sessionTodoActiveCount,
- IconButton,
- Composer,
- useUiLocale,
- type ChatModelChoice,
-} from '@maka/ui';
+import { lazy, Suspense, useState, type ReactNode } from 'react';
+import { Composer, useUiLocale, type ChatModelChoice } from '@maka/ui';
import {
ICON_SIZE,
Activity,
+ Check,
Clipboard,
+ FileDiff,
FolderOpen,
- GitBranch,
Globe,
- ListTodo,
Loader2,
MessageCircleQuestion,
Plus,
Terminal,
- X,
} from '@maka/ui/icons';
import { Badge } from '@astryxdesign/core/Badge';
-import { Button } from '@astryxdesign/core/Button';
import { Card } from '@astryxdesign/core/Card';
-import { ContextMenu } from '@astryxdesign/core/ContextMenu';
+import {
+ DropdownMenu,
+ DropdownMenuItem,
+} from '@astryxdesign/core/DropdownMenu';
import { Heading } from '@astryxdesign/core/Heading';
import { Icon } from '@astryxdesign/core/Icon';
import { Kbd } from '@astryxdesign/core/Kbd';
import { List, ListItem } from '@astryxdesign/core/List';
import { Section } from '@astryxdesign/core/Section';
import { Spinner } from '@astryxdesign/core/Spinner';
-import { Tooltip } from '@astryxdesign/core/Tooltip';
+import { Tab, TabList } from '@astryxdesign/core/TabList';
import type { SessionSummary } from '@maka/core/session';
import { QuoteCompanionPanel } from '../tools/side-chat/quote-companion-panel';
import {
@@ -81,12 +52,13 @@ import {
type SessionWorkbarTabKind,
type SessionWorkbarPanelsState,
type SessionWorkbarPlacement,
- type SessionWorkbarTabsState,
- sessionWorkbarTabsExcept,
- sessionWorkbarTabsToRight,
terminalRefFromWorkbarTab,
} from '../model/workbar-tabs';
-import { useSessionTodo } from '../tools/tasks/use-session-todo';
+import {
+ WORKBAR_TOOL_DEFINITIONS,
+ workbarToolDefinition,
+ type WorkbarToolDefinition,
+} from '../model/workbar-tool-definitions';
import { WorkbarToggle } from './workbar-toggle';
import { WorkBoardPanel } from '../../../work-board-panel.js';
import { getDesktopConversationCopy } from '../../../locales/conversation-copy.js';
@@ -128,34 +100,21 @@ function WorkbarPanelLoading(props: { label: string }) {
}
function WorkbarPanel(props: {
+ id?: string;
active: boolean;
placement: SessionWorkbarPlacement;
overlay?: boolean;
- preview?: boolean;
- onPin?: () => void;
className?: string;
children: ReactNode;
}) {
- const pinPreview = (target: EventTarget | null) => {
- if (!props.preview) return;
- if (
- target instanceof Element &&
- target.closest('[data-tab-preview-pin-exempt]')
- ) {
- return;
- }
- props.onPin?.();
- };
return (
<Section
+ id={props.id}
variant="transparent"
padding={0}
hidden={!props.active}
data-placement={props.placement}
data-overlay={props.overlay || undefined}
- data-preview={props.preview || undefined}
- onPointerDownCapture={(event) => pinPreview(event.target)}
- onKeyDownCapture={(event) => pinPreview(event.target)}
className={
props.className
? `maka-session-workbar-panel ${props.className}`
@@ -171,20 +130,33 @@ function TabCount(props: { count: number }) {
return <Badge variant="neutral" label={props.count} data-maka-contract="session-workbar-count" />;
}
-function tabLabel(
- tab: SessionWorkbarTab,
- tabs: readonly SessionWorkbarTab[],
- copy: ReturnType<typeof getDesktopConversationCopy>['workbar'],
-): string {
- switch (tab.kind) {
+/**
+ * The one place a tool's semantic icon name becomes a glyph.
+ * `workbar-tool-definitions.ts` names the icon; nothing else picks one.
+ */
+const FACE_ICON = {
+ activity: Activity,
+ 'file-diff': FileDiff,
+ folder: FolderOpen,
+ globe: Globe,
+ 'list-todo': Clipboard,
+ 'message-circle-question': MessageCircleQuestion,
+ terminal: Terminal,
+} as const satisfies Record<WorkbarToolDefinition['icon'], typeof Activity>;
+
+function faceIcon(kind: SessionWorkbarTabKind) {
+ return FACE_ICON[workbarToolDefinition(kind).icon];
+}
+
+type WorkbarCopy = ReturnType<typeof getDesktopConversationCopy>['workbar'];
+
+/** A face's own name, before any per-instance numbering. */
+function faceLabel(kind: SessionWorkbarTabKind, copy: WorkbarCopy): string {
+ switch (kind) {
case 'review':
return copy.review;
case 'terminal':
- return tab.ordinal && tab.ordinal > 1
- ? copy.terminalNumbered(tab.ordinal)
- : copy.terminal;
- case 'tasks':
- return copy.tasks;
+ return copy.terminal;
case 'work-board':
return copy.workBoard;
case 'browser':
@@ -193,6 +165,21 @@ function tabLabel(
return copy.files;
case 'inspector':
return copy.inspector;
+ case 'side-chat':
+ return copy.sideChat;
+ }
+}
+
+function tabLabel(
+ tab: SessionWorkbarTab,
+ tabs: readonly SessionWorkbarTab[],
+ copy: WorkbarCopy,
+): string {
+ switch (tab.kind) {
+ case 'terminal':
+ return tab.ordinal && tab.ordinal > 1
+ ? copy.terminalNumbered(tab.ordinal)
+ : copy.terminal;
case 'side-chat':
{
if (tab.title?.trim()) return tab.title.trim();
@@ -203,183 +190,131 @@ function tabLabel(
) + 1;
return index <= 1 ? copy.sideChat : copy.sideChatNumbered(index);
}
+ default:
+ return faceLabel(tab.kind, copy);
}
}
-function tabIcon(tab: SessionWorkbarTab, active: boolean): ReactNode {
- if (active) {
+function tabIcon(tab: SessionWorkbarTab, running: boolean): ReactNode {
+ if (running) {
return (
<Loader2
size={ICON_SIZE.control}
aria-hidden="true"
- className="maka-workbar-tab-icon maka-workbar-tab-spinner"
+ className="maka-workbar-tab-spinner"
/>
);
}
- const Icon =
- tab.kind === 'review'
- ? GitBranch
- : tab.kind === 'terminal'
- ? Terminal
- : tab.kind === 'tasks'
- ? ListTodo
- : tab.kind === 'work-board'
- ? Clipboard
- : tab.kind === 'browser'
- ? Globe
- : tab.kind === 'files'
- ? FolderOpen
- : tab.kind === 'inspector'
- ? Activity
- : MessageCircleQuestion;
- return <Icon size={ICON_SIZE.control} aria-hidden="true" className="maka-workbar-tab-icon" />;
+ const FaceIcon = faceIcon(tab.kind);
+ return <FaceIcon size={ICON_SIZE.control} aria-hidden="true" />;
+}
+
+/**
+ * The strip, and the one control that opens and closes faces.
+ *
+ * `Tab` renders `endContent` inside its own `<button>`, so a per-tab close
+ * would nest a button in a button, and `TabList` warns when a `role="tablist"`
+ * strip's direct children are not tabs. Opening and closing therefore share the
+ * [+] menu: every face is listed, the open ones carry a checkmark, and picking
+ * one toggles it. The menu holds no shortcuts — the launcher below lists every
+ * face with its own, and that is where a shortcut is learned.
+ */
+function WorkbarFaceMenu(props: {
+ tabs: readonly SessionWorkbarTab[];
+ sideChatAvailable: boolean;
+ onOpen: (kind: SessionWorkbarTabKind) => void;
+ onCloseKind: (kind: SessionWorkbarTabKind) => void;
+}) {
+ const copy = getDesktopConversationCopy(useUiLocale()).workbar;
+ return (
+ <DropdownMenu
+ button={{
+ variant: 'ghost',
+ size: 'sm',
+ isIconOnly: true,
+ label: copy.openTab,
+ icon: <Plus size={ICON_SIZE.control} aria-hidden />,
+ }}
+ >
+ {WORKBAR_TOOL_DEFINITIONS.map((definition) => {
+ const FaceIcon = FACE_ICON[definition.icon];
+ const isOpen = props.tabs.some((tab) => tab.kind === definition.kind);
+ return (
+ <DropdownMenuItem
+ key={definition.kind}
+ label={faceLabel(definition.kind, copy)}
+ icon={<FaceIcon size={ICON_SIZE.control} aria-hidden />}
+ endContent={isOpen ? <Check size={ICON_SIZE.control} aria-hidden /> : undefined}
+ isDisabled={definition.kind === 'side-chat' && !props.sideChatAvailable}
+ hasCloseOnSelect={false}
+ onClick={() =>
+ isOpen
+ ? props.onCloseKind(definition.kind)
+ : props.onOpen(definition.kind)
+ }
+ />
+ );
+ })}
+ </DropdownMenu>
+ );
}
function WorkbarTabStrip(props: {
placement: SessionWorkbarPlacement;
tabs: readonly SessionWorkbarTab[];
activeTabId: string | null;
- taskCount: number;
artifactCount: number;
+ sideChatAvailable: boolean;
activeSideChatPanelIds?: ReadonlySet<string>;
onActivate: (tabId: string) => void;
- onClose: (tab: SessionWorkbarTab) => void;
- onCloseTabs: (tabs: readonly SessionWorkbarTab[]) => void;
- onReorder: (tabId: string, targetTabId: string) => void;
- onMove: (tabId: string, direction: 'left' | 'right') => void;
- onMoveToPanel: (tabId: string, target: SessionWorkbarPlacement) => void;
- onPin: (tabId: string) => void;
- onOpenLauncher: () => void;
+ onOpenKind: (kind: SessionWorkbarTabKind) => void;
+ onCloseKind: (kind: SessionWorkbarTabKind) => void;
onCollapseRightPanel?: () => void;
}) {
const copy = getDesktopConversationCopy(useUiLocale()).workbar;
- const tabListRef = useRef<HTMLDivElement>(null);
- const sensors = useSensors(
- useSensor(PointerSensor, {
- activationConstraint: { distance: 6 },
- }),
- );
- const handleDragEnd = (event: DragEndEvent) => {
- const activeId = String(event.active.id);
- const targetId = event.over ? String(event.over.id) : null;
- if (targetId && targetId !== activeId) props.onReorder(activeId, targetId);
- };
- const handleTabKeyDown = (
- tabId: string,
- event: ReactKeyboardEvent<HTMLButtonElement>,
- ) => {
- const currentIndex = props.tabs.findIndex((tab) => tab.id === tabId);
- if (currentIndex < 0) return;
- const targetIndex =
- event.key === 'ArrowLeft'
- ? Math.max(0, currentIndex - 1)
- : event.key === 'ArrowRight'
- ? Math.min(props.tabs.length - 1, currentIndex + 1)
- : event.key === 'Home'
- ? 0
- : event.key === 'End'
- ? props.tabs.length - 1
- : -1;
- const target = props.tabs[targetIndex];
- if (!target || target.id === tabId) return;
- event.preventDefault();
- props.onActivate(target.id);
- window.requestAnimationFrame(() => {
- tabListRef.current
- ?.querySelector<HTMLElement>(
- `[data-workbar-tab-id="${CSS.escape(target.id)}"] [role="tab"]`,
- )
- ?.focus();
- });
- };
- useEffect(() => {
- const tabList = tabListRef.current;
- if (!tabList || !props.activeTabId) return;
- let frame = 0;
- const revealActiveTab = () => {
- window.cancelAnimationFrame(frame);
- frame = window.requestAnimationFrame(() => {
- const activeTab = tabList.querySelector<HTMLElement>(
- `[data-workbar-tab-id="${CSS.escape(props.activeTabId ?? '')}"]`,
- );
- if (!activeTab) return;
- const listBox = tabList.getBoundingClientRect();
- const tabBox = activeTab.getBoundingClientRect();
- if (tabBox.left < listBox.left) {
- tabList.scrollLeft -= listBox.left - tabBox.left;
- } else if (tabBox.right > listBox.right) {
- tabList.scrollLeft += tabBox.right - listBox.right;
- }
- });
- };
- revealActiveTab();
- const observer = new ResizeObserver(revealActiveTab);
- observer.observe(tabList);
- return () => {
- observer.disconnect();
- window.cancelAnimationFrame(frame);
- };
- }, [props.activeTabId, props.tabs.length]);
return (
+ // TabList sits in a `min-width: 0` flex item on purpose. A flex item
+ // defaults to `min-width: auto`, so a strip without the reset refuses to
+ // shrink: it spills past the panel and pushes [+] and the collapse toggle
+ // off the edge instead of scrolling.
<div className="maka-workbar-tab-strip">
- <DndContext
- sensors={sensors}
- collisionDetection={closestCenter}
- onDragEnd={handleDragEnd}
- >
- <SortableContext
- items={props.tabs.map((tab) => tab.id)}
- strategy={horizontalListSortingStrategy}
- >
- <div
- ref={tabListRef}
- className="maka-workbar-tab-list"
+ <div className="maka-workbar-tab-list">
+ {props.tabs.length > 0 ? (
+ <TabList
+ size="sm"
+ hasDivider
role="tablist"
aria-label={copy.sectionsAriaLabel}
+ value={props.activeTabId ?? props.tabs[0]!.id}
+ onChange={(next) => props.onActivate(String(next))}
>
- {props.tabs.map((tab, index) => (
- <SortableWorkbarTab
- key={tab.id}
- tab={tab}
- index={index}
- tabs={props.tabs}
- selected={tab.id === props.activeTabId}
- running={
- tab.kind === 'side-chat' &&
- props.activeSideChatPanelIds?.has(
- tab.id.slice('side-chat:'.length),
- ) === true
- }
- count={
- tab.kind === 'tasks'
- ? props.taskCount
- : tab.kind === 'files'
- ? props.artifactCount
- : undefined
- }
- onActivate={props.onActivate}
- onClose={props.onClose}
- onCloseTabs={props.onCloseTabs}
- onMove={props.onMove}
- placement={props.placement}
- onMoveToPanel={props.onMoveToPanel}
- onPin={props.onPin}
- onKeyDown={handleTabKeyDown}
- />
- ))}
- </div>
- </SortableContext>
- </DndContext>
- <Tooltip content={copy.openTab}>
- <IconButton
- label={copy.openTab}
- icon={<Plus size={ICON_SIZE.control} aria-hidden />}
- variant="ghost"
- size="sm"
- className="maka-workbar-new-tab"
- onClick={props.onOpenLauncher}
- />
- </Tooltip>
+ {props.tabs.map((tab) => {
+ const running =
+ tab.kind === 'side-chat' &&
+ props.activeSideChatPanelIds?.has(
+ tab.id.slice('side-chat:'.length),
+ ) === true;
+ const count = tab.kind === 'files' ? props.artifactCount : undefined;
+ return (
+ <Tab
+ key={tab.id}
+ value={tab.id}
+ label={tabLabel(tab, props.tabs, copy)}
+ panelId={`maka-workbar-panel-${tab.id}`}
+ icon={tabIcon(tab, running)}
+ endContent={count !== undefined ? <TabCount count={count} /> : undefined}
+ />
+ );
+ })}
+ </TabList>
+ ) : null}
+ </div>
+ <WorkbarFaceMenu
+ tabs={props.tabs}
+ sideChatAvailable={props.sideChatAvailable}
+ onOpen={props.onOpenKind}
+ onCloseKind={props.onCloseKind}
+ />
{props.placement === 'right' && props.onCollapseRightPanel ? (
<WorkbarToggle
collapsed={false}
@@ -391,235 +326,14 @@ function WorkbarTabStrip(props: {
);
}
-function SortableWorkbarTab(props: {
- placement: SessionWorkbarPlacement;
- tab: SessionWorkbarTab;
- index: number;
- tabs: readonly SessionWorkbarTab[];
- selected: boolean;
- running: boolean;
- count?: number;
- onActivate: (tabId: string) => void;
- onClose: (tab: SessionWorkbarTab) => void;
- onCloseTabs: (tabs: readonly SessionWorkbarTab[]) => void;
- onMove: (tabId: string, direction: 'left' | 'right') => void;
- onMoveToPanel: (tabId: string, target: SessionWorkbarPlacement) => void;
- onPin: (tabId: string) => void;
- onKeyDown: (
- tabId: string,
- event: ReactKeyboardEvent<HTMLButtonElement>,
- ) => void;
-}) {
- const copy = getDesktopConversationCopy(useUiLocale()).workbar;
- const label = tabLabel(props.tab, props.tabs, copy);
- const {
- isDragging,
- listeners,
- setNodeRef,
- transform,
- transition,
- } = useSortable({ id: props.tab.id });
- const style = {
- transform: transform
- ? `translate3d(${Math.round(transform.x)}px, 0, 0)`
- : undefined,
- transition,
- } satisfies CSSProperties;
- const otherTabs = sessionWorkbarTabsExcept(
- {
- tabs: [...props.tabs],
- activeTabId: props.tab.id,
- launcherOpen: false,
- activationHistory: [props.tab.id],
- },
- props.tab.id,
- );
- const tabsToRight = sessionWorkbarTabsToRight(
- {
- tabs: [...props.tabs],
- activeTabId: props.tab.id,
- launcherOpen: false,
- activationHistory: [props.tab.id],
- },
- props.tab.id,
- );
-
- return (
- <ContextMenu
- className="maka-workbar-tab-context"
- label={copy.tabMenu(label)}
- size="sm"
- items={[
- ...(props.tab.preview
- ? [
- {
- label: copy.pinTab,
- onClick: () => props.onPin(props.tab.id),
- },
- { type: 'divider' as const },
- ]
- : []),
- {
- label: copy.moveLeft,
- isDisabled: props.index === 0,
- onClick: () => props.onMove(props.tab.id, 'left'),
- },
- {
- label: copy.moveRight,
- isDisabled: props.index === props.tabs.length - 1,
- onClick: () => props.onMove(props.tab.id, 'right'),
- },
- {
- label:
- props.placement === 'right'
- ? copy.moveToBottom
- : copy.moveToRight,
- onClick: () =>
- props.onMoveToPanel(
- props.tab.id,
- props.placement === 'right' ? 'bottom' : 'right',
- ),
- },
- { type: 'divider' },
- {
- label: copy.close,
- onClick: () => props.onClose(props.tab),
- },
- {
- label: copy.closeOthers,
- isDisabled: otherTabs.length === 0,
- onClick: () => props.onCloseTabs(otherTabs),
- },
- {
- label: copy.closeToRight,
- isDisabled: tabsToRight.length === 0,
- onClick: () => props.onCloseTabs(tabsToRight),
- },
- ]}
- >
- <div
- ref={setNodeRef}
- className="maka-workbar-tab"
- data-workbar-tab-id={props.tab.id}
- data-active={props.selected || undefined}
- data-dragging={isDragging || undefined}
- data-running={props.running || undefined}
- data-preview={props.tab.preview || undefined}
- style={style}
- >
- <Button
- type="button"
- variant="ghost"
- size="sm"
- role="tab"
- label={
- props.count !== undefined
- ? `${label}, ${props.count}`
- : label
- }
- aria-selected={props.selected}
- aria-busy={props.running || undefined}
- tabIndex={props.selected ? 0 : -1}
- className="maka-workbar-tab-select"
- onClick={() => props.onActivate(props.tab.id)}
- {...listeners}
- onKeyDown={(event) => props.onKeyDown(props.tab.id, event)}
- onDoubleClick={() => {
- if (props.tab.preview) props.onPin(props.tab.id);
- }}
- icon={tabIcon(props.tab, props.running)}
- endContent={props.count !== undefined ? <TabCount count={props.count} /> : undefined}
- >
- <span
- className="maka-workbar-tab-label"
- title={props.tab.preview ? `${label} · ${copy.pinTabHint}` : label}
- >
- {label}
- </span>
- </Button>
- <Tooltip content={copy.closeTab(label)}>
- <IconButton
- label={copy.closeTab(label)}
- icon={<X size={ICON_SIZE.meta} aria-hidden />}
- variant="ghost"
- size="sm"
- className="maka-workbar-tab-close"
- onClick={() => props.onClose(props.tab)}
- />
- </Tooltip>
- </div>
- </ContextMenu>
- );
-}
-
function WorkbarLauncher(props: {
onOpen: (kind: SessionWorkbarTabKind) => void;
sideChatAvailable: boolean;
}) {
const copy = getDesktopConversationCopy(useUiLocale()).workbar;
- const actions: Array<{
- kind: SessionWorkbarTabKind;
- label: string;
- description: string;
- icon: typeof Activity;
- shortcut?: string;
- disabled?: boolean;
- }> = [
- {
- kind: 'side-chat',
- label: copy.sideChat,
- description: copy.launcher.sideChat,
- icon: MessageCircleQuestion,
- shortcut: 'mod+alt+s',
- disabled: !props.sideChatAvailable,
- },
- {
- kind: 'review',
- label: copy.review,
- description: copy.launcher.review,
- icon: GitBranch,
- shortcut: 'ctrl+shift+g',
- },
- {
- kind: 'terminal',
- label: copy.terminal,
- description: copy.launcher.terminal,
- icon: Terminal,
- shortcut: 'ctrl+`',
- },
- {
- kind: 'browser',
- label: copy.browser,
- description: copy.launcher.browser,
- icon: Globe,
- shortcut: 'mod+t',
- },
- {
- kind: 'files',
- label: copy.files,
- description: copy.launcher.files,
- icon: FolderOpen,
- shortcut: 'mod+p',
- },
- {
- kind: 'tasks',
- label: copy.tasks,
- description: copy.launcher.tasks,
- icon: ListTodo,
- },
- {
- kind: 'work-board',
- label: copy.workBoard,
- description: copy.launcher.workBoard,
- icon: Clipboard,
- },
- {
- kind: 'inspector',
- label: copy.inspector,
- description: copy.launcher.inspector,
- icon: Activity,
- },
- ];
+ // The list is the tool registry, in registry order — icons and shortcuts
+ // included. This is the one place a face's shortcut is shown, so it is also
+ // where the shortcuts are learned.
return (
<div className="maka-workbar-launcher">
<div className="maka-workbar-launcher-frame">
@@ -628,19 +342,19 @@ function WorkbarLauncher(props: {
density="compact"
header={<Heading level={4}>{copy.openTools}</Heading>}
>
- {actions.map((action) => (
+ {WORKBAR_TOOL_DEFINITIONS.map((definition) => (
<ListItem
- key={action.kind}
- startContent={<Icon icon={action.icon} size="sm" color="secondary" />}
- label={action.label}
- description={action.description}
+ key={definition.kind}
+ startContent={
+ <Icon icon={FACE_ICON[definition.icon]} size="sm" color="secondary" />
+ }
+ label={faceLabel(definition.kind, copy)}
+ description={copy.launcher[launcherCopyKey(definition.kind)]}
endContent={
- action.shortcut ? (
- <Kbd keys={action.shortcut} />
- ) : undefined
+ definition.shortcut ? <Kbd keys={definition.shortcut} /> : undefined
}
- isDisabled={action.disabled}
- onClick={() => props.onOpen(action.kind)}
+ isDisabled={definition.kind === 'side-chat' && !props.sideChatAvailable}
+ onClick={() => props.onOpen(definition.kind)}
/>
))}
</List>
@@ -649,6 +363,16 @@ function WorkbarLauncher(props: {
);
}
+function launcherCopyKey(
+ kind: SessionWorkbarTabKind,
+): keyof WorkbarCopy['launcher'] {
+ return kind === 'side-chat'
+ ? 'sideChat'
+ : kind === 'work-board'
+ ? 'workBoard'
+ : kind;
+}
+
export function WorkbarSurface(props: {
sessionId: string;
projectId?: string | null;
@@ -664,18 +388,6 @@ export function WorkbarSurface(props: {
placement: SessionWorkbarPlacement,
tabs: readonly SessionWorkbarTab[],
) => void;
- onReorderTab: (
- placement: SessionWorkbarPlacement,
- tabId: string,
- targetTabId: string,
- ) => void;
- onMoveTab: (
- placement: SessionWorkbarPlacement,
- tabId: string,
- direction: 'left' | 'right',
- ) => void;
- onMoveTabToPanel: (tabId: string, target: SessionWorkbarPlacement) => void;
- onPinTab: (tabId: string) => void;
onOpenLauncher: (placement: SessionWorkbarPlacement) => void;
onRequestOpenTab: (
placement: SessionWorkbarPlacement,
@@ -696,11 +408,6 @@ export function WorkbarSurface(props: {
}) {
const locale = useUiLocale();
const copy = getDesktopConversationCopy(locale).workbar;
- const sessionTodo = useSessionTodo(props.sessionId, {
- locale,
- loadFailed: copy.todoLoadFailed,
- });
- const taskCount = sessionTodoActiveCount(sessionTodo.items);
const [artifactCount, setArtifactCount] = useState(0);
const placements: SessionWorkbarPlacement[] = ['right', 'bottom'];
const positionedTabs = placements.flatMap((placement) =>
@@ -738,21 +445,17 @@ export function WorkbarSurface(props: {
tabs={panel.tabs}
activeTabId={showingLauncher ? null : panel.activeTabId}
activeSideChatPanelIds={props.activeSideChatPanelIds}
- taskCount={taskCount}
artifactCount={artifactCount}
+ sideChatAvailable={props.sourceSession !== undefined}
onActivate={(tabId) => props.onActivateTab(placement, tabId)}
- onClose={(tab) => props.onCloseTab(placement, tab)}
- onCloseTabs={(tabs) => props.onCloseTabs(placement, tabs)}
- onReorder={(tabId, targetTabId) =>
- props.onReorderTab(placement, tabId, targetTabId)
- }
- onMove={(tabId, direction) =>
- props.onMoveTab(placement, tabId, direction)
+ onOpenKind={(kind) => props.onRequestOpenTab(placement, kind)}
+ onCloseKind={(kind) =>
+ props.onCloseTabs(
+ placement,
+ panel.tabs.filter((tab) => tab.kind === kind),
+ )
}
- onMoveToPanel={props.onMoveTabToPanel}
- onPin={props.onPinTab}
placement={placement}
- onOpenLauncher={() => props.onOpenLauncher(placement)}
onCollapseRightPanel={
placement === 'right'
? () => props.onDismissPanel('right')
@@ -798,15 +501,6 @@ export function WorkbarSurface(props: {
/>
</Suspense>
);
- } else if (tab.kind === 'tasks') {
- content = (
- <SessionTodoPanel
- items={sessionTodo.items}
- loading={sessionTodo.loading}
- error={sessionTodo.error}
- onRetry={sessionTodo.retry}
- />
- );
} else if (tab.kind === 'work-board') {
content = (
<WorkBoardPanel
@@ -869,11 +563,10 @@ export function WorkbarSurface(props: {
return content ? (
<WorkbarPanel
key={tab.id}
+ id={`maka-workbar-panel-${tab.id}`}
active={active}
placement={placement}
overlay
- preview={tab.preview}
- onPin={() => props.onPinTab(tab.id)}
className={
tab.kind === 'side-chat' ? 'maka-quote-workbar-panel' : undefined
}
diff --git a/apps/desktop/src/renderer/locales/conversation-copy.ts b/apps/desktop/src/renderer/locales/conversation-copy.ts
index 797dda1f15..4d5af4082c 100644
--- a/apps/desktop/src/renderer/locales/conversation-copy.ts
+++ b/apps/desktop/src/renderer/locales/conversation-copy.ts
@@ -96,8 +96,6 @@ export interface DesktopConversationCopy {
review: string;
terminal: string;
terminalNumbered(index: number): string;
- tasks: string;
- todoLoadFailed: string;
workBoard: string;
browser: string;
files: string;
@@ -106,21 +104,9 @@ export interface DesktopConversationCopy {
sideChatNumbered(index: number): string;
openTab: string;
openTools: string;
- closeTab(label: string): string;
- tabMenu(label: string): string;
- moveLeft: string;
- moveRight: string;
- moveToRight: string;
- moveToBottom: string;
- pinTab: string;
- pinTabHint: string;
- close: string;
- closeOthers: string;
- closeToRight: string;
launcher: {
review: string;
terminal: string;
- tasks: string;
workBoard: string;
browser: string;
files: string;
@@ -486,31 +472,17 @@ const COPY = {
review: '变更',
terminal: '终端',
terminalNumbered: (index) => `终端 ${index}`,
- tasks: '待办',
- todoLoadFailed: '待办载入失败,请重试。',
workBoard: '工作看板',
browser: '浏览器',
files: '生成文件',
inspector: '追踪',
sideChat: '侧边对话',
sideChatNumbered: (index) => `侧边对话 ${index}`,
- openTab: '打开工作栏标签',
+ openTab: '打开或关闭工作栏的面',
openTools: '打开工具',
- closeTab: (label) => `关闭${label}`,
- tabMenu: (label) => `${label}标签菜单`,
- moveLeft: '向左移动',
- moveRight: '向右移动',
- moveToRight: '移动到右侧面板',
- moveToBottom: '移动到底部面板',
- pinTab: '固定标签',
- pinTabHint: '预览标签,双击或在内容中操作即可固定',
- close: '关闭',
- closeOthers: '关闭其他标签',
- closeToRight: '关闭右侧标签',
launcher: {
review: '查看当前 Git 工作区变化',
terminal: '查看当前任务的终端运行和实时输出',
- tasks: '查看和维护这个任务的待办台账',
workBoard: '记录和管理暂缓事项',
browser: '打开内置浏览器并保留当前页面',
files: '浏览当前任务生成的文件',
@@ -740,31 +712,17 @@ const COPY = {
review: 'Changes',
terminal: 'Terminal',
terminalNumbered: (index) => `Terminal ${index}`,
- tasks: 'To-do',
- todoLoadFailed: 'Failed to load the to-do list. Try again.',
workBoard: 'Work board',
browser: 'Browser',
files: 'Generated files',
inspector: 'Trace',
sideChat: 'Side chat',
sideChatNumbered: (index) => `Side chat ${index}`,
- openTab: 'Open workbar tab',
+ openTab: 'Open or close a workbar face',
openTools: 'Open tools',
- closeTab: (label) => `Close ${label}`,
- tabMenu: (label) => `${label} tab menu`,
- moveLeft: 'Move left',
- moveRight: 'Move right',
- moveToRight: 'Move to right panel',
- moveToBottom: 'Move to bottom panel',
- pinTab: 'Pin tab',
- pinTabHint: 'Preview tab. Double-click or interact with its content to pin it',
- close: 'Close',
- closeOthers: 'Close other tabs',
- closeToRight: 'Close tabs to the right',
launcher: {
review: 'View changes in the current Git workspace',
terminal: 'Inspect terminal runs and live output for this task',
- tasks: "View and maintain this task's to-do ledger",
workBoard: 'Capture and manage deferred work',
browser: 'Open the embedded browser and keep the current page',
files: 'Browse files generated by this task',
diff --git a/apps/desktop/src/renderer/styles.css b/apps/desktop/src/renderer/styles.css
index 02e5062d64..d07f44133b 100644
--- a/apps/desktop/src/renderer/styles.css
+++ b/apps/desktop/src/renderer/styles.css
@@ -47,7 +47,6 @@
@import "./styles/settings/select.css" layer(components);
@import "./styles/model-switcher.css" layer(components);
@import "./styles/chat-header.css" layer(components);
-@import "./styles/session-todo-panel.css" layer(components);
@import "./styles/work-board.css" layer(components);
@import "./styles/plan-mode.css" layer(components);
@import "./styles/agent-graph.css" layer(components);
diff --git a/apps/desktop/src/renderer/styles/session-todo-panel.css b/apps/desktop/src/renderer/styles/session-todo-panel.css
deleted file mode 100644
index f4df8be5ac..0000000000
--- a/apps/desktop/src/renderer/styles/session-todo-panel.css
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/* SessionTodoPanel (#4351) — the read-only, flat projection of the Host-owned
- current Todo document. It replaced the nested Task Ledger demand chain, so
- this sheet was reduced (#4394) to what the flat list actually renders: a
- `-panel` scroll container, a `-tree` <ol>, and one `-row` <li> per item that
- holds a status icon and its content text. The retired four-column,
- depth-indented tree row — its `--task-depth` indent, `-group`,
- `[data-status]`, `-key`/`-subject`/`-meta`/`-detail`, and `-terminal`
- descendants — is gone; none of those elements exist anymore. */
-
-.maka-session-todo-panel {
- height: 100%;
- min-height: 0;
- overflow-y: auto;
- padding: var(--space-2);
-}
-
-.maka-session-todo-tree {
- display: grid;
- gap: var(--border-width-hairline);
-}
-
-/* Two children only: the status icon, then content that takes the remaining
- width and wraps within it (`minmax(0, 1fr)` lets the text column shrink so
- long, unbroken content wraps instead of overflowing the workbar). The
- workbar resizes down to SESSION_WORKBAR_MIN_WIDTH (320px) inside an
- otherwise wide window, so wrapping — not a width breakpoint — is what keeps
- the row readable at every width. If width-responsive styling is ever added
- here it should be an `@container` query on `.maka-session-todo-panel` (see
- workbar/inspector.css and chat-header.css), not a viewport `@media`. */
-.maka-session-todo-row {
- font: var(--maka-text-supporting);
- display: grid;
- grid-template-columns: auto minmax(0, 1fr);
- align-items: center;
- gap: var(--space-2);
- min-height: 32px;
- padding: var(--space-1) var(--space-2);
- border-radius: var(--radius-control);
- color: var(--muted-foreground);
-}
-
-.maka-session-todo-row > span {
- min-width: 0;
- overflow-wrap: anywhere;
-}
-
-.maka-session-todo-row:hover { background: var(--state-hover-bg); }
-
-.maka-session-todo-message {
- font: var(--maka-text-supporting);
- display: flex;
- align-items: center;
- justify-content: space-between;
- min-height: 32px;
- padding: var(--space-1) var(--space-2);
- color: var(--muted-foreground);
-}
-
-.maka-session-todo-retry {
- display: inline-grid;
- width: 28px;
- height: 28px;
- place-items: center;
- border: 0;
- border-radius: var(--radius-control);
- background: transparent;
- color: inherit;
-}
-
-.maka-session-todo-retry:hover { background: var(--state-hover-bg); }
-
-.maka-session-todo-retry:focus-visible {
- outline: var(--focus-ring-width) solid var(--focus-ring);
- outline-offset: 1px;
-}
diff --git a/apps/desktop/src/renderer/styles/workbar/shell.css b/apps/desktop/src/renderer/styles/workbar/shell.css
index 444ad1567d..c2b49fe914 100644
--- a/apps/desktop/src/renderer/styles/workbar/shell.css
+++ b/apps/desktop/src/renderer/styles/workbar/shell.css
@@ -66,7 +66,7 @@
.maka-session-workbar[data-placement="right"] {
grid-area: right;
width: var(--maka-session-workbar-width, 480px);
- min-width: 320px;
+ min-width: 340px;
max-width: 600px;
margin-left: var(--agents-content-area-gap);
}
@@ -105,7 +105,7 @@
.maka-session-workbar-panel[data-overlay][data-placement="right"] {
grid-area: right;
width: var(--maka-session-workbar-width, 480px);
- min-width: 320px;
+ min-width: 340px;
max-width: 600px;
margin-left: var(--agents-content-area-gap);
padding-top: var(--maka-plate-titlebar-clearance);
@@ -158,131 +158,30 @@
.maka-workbar-tab-strip {
display: flex;
align-items: center;
+ gap: var(--space-1);
width: 100%;
min-width: 0;
flex: 0 0 auto;
+ /* The bar's height comes from the titlebar clearance it stands in, never from
+ the strip. `hasDivider` makes TabList reserve its rail, so a strip is a
+ little taller than the bare buttons beside it; letting it set the height
+ would grow the bar the moment the first face opened and shift the whole
+ panel under the cursor. */
+ height: 100%;
}
+/* A flex item defaults to `min-width: auto`, so without this reset the strip
+ refuses to shrink: it spills past the panel and pushes [+] and the collapse
+ toggle off the edge instead of scrolling inside itself. */
.maka-workbar-tab-list {
- display: flex;
- align-items: center;
flex: 1 1 auto;
- gap: var(--space-1);
- min-width: 0;
- overflow-x: auto;
- overscroll-behavior-x: contain;
- scroll-padding-inline: var(--space-1);
- scrollbar-width: none;
-}
-
-.maka-workbar-tab-list::-webkit-scrollbar {
- display: none;
-}
-
-.maka-workbar-tab-context {
- flex: 0 0 auto;
min-width: 0;
}
-.maka-workbar-tab {
- position: relative;
- display: inline-flex;
- align-items: center;
- flex: 0 0 auto;
- min-width: 0;
- height: var(--size-element-sm);
- border-radius: var(--radius-element);
- color: var(--muted-foreground);
- touch-action: none;
- user-select: none;
- transition:
- background var(--duration-quick) var(--ease-out-strong),
- color var(--duration-quick) var(--ease-out-strong);
-}
-
-.maka-workbar-tab:hover,
-.maka-workbar-tab[data-active] {
- background: var(--state-hover-bg);
- color: var(--foreground);
-}
-
-.maka-workbar-tab[data-active]::after {
- position: absolute;
- right: var(--space-2);
- bottom: -1px;
- left: var(--space-2);
- height: 2px;
- border-radius: var(--radius-full);
- background: var(--color-accent);
- content: "";
-}
-
-.maka-workbar-tab[data-dragging] {
- z-index: 2;
- opacity: 0.72;
- box-shadow: var(--shadow-low);
-}
-
-.maka-workbar-tab-icon {
- width: var(--icon-control);
- height: var(--icon-control);
- flex: 0 0 auto;
-}
-
.maka-workbar-tab-spinner {
animation: maka-spin 1s linear infinite;
}
-.maka-workbar-tab-select {
- display: inline-flex;
- align-items: center;
- gap: var(--space-1);
- min-width: 0;
- min-height: 0;
- height: 100%;
- padding: 0 var(--space-1) 0 var(--space-3);
- border: 0;
- border-radius: 0;
- background: transparent;
- color: inherit;
- cursor: pointer;
- font: var(--maka-text-supporting);
- box-shadow: none;
-}
-
-.maka-workbar-tab[data-active] .maka-workbar-tab-select {
- font-weight: var(--font-weight-semibold);
-}
-
-.maka-workbar-tab-select:focus-visible {
- border-radius: var(--radius-element);
- outline: var(--focus-ring-width) solid var(--focus-ring);
- outline-offset: calc(-1 * var(--focus-ring-width));
-}
-
-.maka-workbar-tab[data-preview] .maka-workbar-tab-label {
- font-style: italic;
-}
-
-.maka-workbar-tab-label {
- overflow: hidden;
- max-width: 112px;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.maka-workbar-tab-close {
- position: relative;
- z-index: 1;
- flex: 0 0 auto;
- margin-right: 1px;
-}
-
-.maka-workbar-new-tab {
- flex: 0 0 auto;
- margin-left: var(--space-1);
-}
-
.maka-workbar-panel-toggle {
flex: 0 0 auto;
margin-left: var(--space-1);
diff --git a/apps/desktop/stories/accessibility-runtime-surfaces.stories.tsx b/apps/desktop/stories/accessibility-runtime-surfaces.stories.tsx
index 3bd8066b29..ffc98ef4ed 100644
--- a/apps/desktop/stories/accessibility-runtime-surfaces.stories.tsx
+++ b/apps/desktop/stories/accessibility-runtime-surfaces.stories.tsx
@@ -95,10 +95,6 @@ function WorkbarToolSurface(props: { kind: 'terminal' | 'browser' | 'files' }) {
onActivateTab={noop}
onCloseTab={noop}
onCloseTabs={noop}
- onReorderTab={noop}
- onMoveTab={noop}
- onMoveTabToPanel={noop}
- onPinTab={noop}
onOpenLauncher={noop}
onRequestOpenTab={noop}
confirmBypass={async () => true}
diff --git a/apps/desktop/stories/session-workbar.stories.tsx b/apps/desktop/stories/session-workbar.stories.tsx
index 71329da3c1..67a27bd307 100644
--- a/apps/desktop/stories/session-workbar.stories.tsx
+++ b/apps/desktop/stories/session-workbar.stories.tsx
@@ -992,6 +992,11 @@ function Workbar(props: {
// Fill the preview viewport like AppShell fills the window; a fixed
// height pushes the stacked workbar below the fold in short windows.
height: '100dvh',
+ // AppShell declares this on the frame that holds the plates, and the
+ // workbar's own grid reserves its first row with it. Without it the
+ // strip's row collapses and the bar floats mid-panel, so the story
+ // stops showing the shell it exists to pin.
+ '--maka-plate-titlebar-clearance': 'calc(var(--h-titlebar) - var(--agents-content-area-gap))',
...(props.width ? { '--maka-session-workbar-width': `${props.width}px` } : {}),
} as CSSProperties}
>
@@ -1006,10 +1011,6 @@ function Workbar(props: {
onActivateTab={noop}
onCloseTab={noop}
onCloseTabs={noop}
- onReorderTab={noop}
- onMoveTab={noop}
- onMoveTabToPanel={noop}
- onPinTab={noop}
onOpenLauncher={noop}
onRequestOpenTab={noop}
confirmBypass={async () => true}
@@ -1190,26 +1191,6 @@ export const TerminalWriteFailed: Story = {
},
};
-// Real path: sidebar → a session → 展开任务工作栏, landing on the tab the app
-// restored. Tasks is the default: an in-progress root, a child claimed and
-// blocked by a subagent, and the finished ones folded into 最近结束.
-export const Tasks: Story = {
- decorators: [bridge()],
- render: () => <Workbar tab="tasks" />,
-};
-
-// Real path: 任务工作栏 → 任务 on a session whose agent never wrote a task.
-export const TasksEmpty: Story = {
- decorators: [bridge({ tasks: [] })],
- render: () => <Workbar tab="tasks" />,
-};
-
-// Real path: 任务工作栏 → 任务 when `tasks.list` rejects; 重试 re-runs the read.
-export const TasksLoadFailed: Story = {
- decorators: [bridge({ tasksFail: true })],
- render: () => <Workbar tab="tasks" />,
-};
-
// Storybook cannot host the native WebContentsView, so these pin what the panel
// itself draws — chrome and empty state — inside the real workbar shell.
export const BrowserEmpty: Story = {
diff --git a/package-lock.json b/package-lock.json
index 096a003ab3..00913c235d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -66,8 +66,6 @@
"@astryxdesign/core": "0.5.2",
"@astryxdesign/theme-neutral": "0.5.2",
"@babel/parser": "7.29.7",
- "@dnd-kit/core": "^6.3.1",
- "@dnd-kit/sortable": "^10.0.0",
"@fontsource-variable/geist": "^5.3.0",
"@fontsource-variable/geist-mono": "^5.3.0",
"@maka/ui": "0.1.0",
@@ -1695,63 +1693,6 @@
"node": ">=0.1.90"
}
},
- "node_modules/@dnd-kit/accessibility": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/@dnd-kit/accessibility/-/accessibility-3.1.1.tgz",
- "integrity": "sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "tslib": "^2.0.0"
- },
- "peerDependencies": {
- "react": ">=16.8.0"
- }
- },
- "node_modules/@dnd-kit/core": {
- "version": "6.3.1",
- "resolved": "https://registry.npmjs.org/@dnd-kit/core/-/core-6.3.1.tgz",
- "integrity": "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@dnd-kit/accessibility": "^3.1.1",
- "@dnd-kit/utilities": "^3.2.2",
- "tslib": "^2.0.0"
- },
- "peerDependencies": {
- "react": ">=16.8.0",
- "react-dom": ">=16.8.0"
- }
- },
- "node_modules/@dnd-kit/sortable": {
- "version": "10.0.0",
- "resolved": "https://registry.npmjs.org/@dnd-kit/sortable/-/sortable-10.0.0.tgz",
- "integrity": "sha512-+xqhmIIzvAYMGfBYYnbKuNicfSsk4RksY2XdmJhT+HAC01nix6fHCztU68jooFiMUB01Ky3F0FyOvhG/BZrWkg==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@dnd-kit/utilities": "^3.2.2",
- "tslib": "^2.0.0"
- },
- "peerDependencies": {
- "@dnd-kit/core": "^6.3.0",
- "react": ">=16.8.0"
- }
- },
- "node_modules/@dnd-kit/utilities": {
- "version": "3.2.2",
- "resolved": "https://registry.npmjs.org/@dnd-kit/utilities/-/utilities-3.2.2.tgz",
- "integrity": "sha512-+MKAJEOfaBe5SmV6t34p80MMKhjvUz0vRrvVJbPT0WElzaOJ/1xs+D+KDv+tD/NE5ujfrChEcshd4fLn0wpiqg==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "tslib": "^2.0.0"
- },
- "peerDependencies": {
- "react": ">=16.8.0"
- }
- },
"node_modules/@earendil-works/pi-tui": {
"version": "0.84.2",
"resolved": "https://registry.npmjs.org/@earendil-works/pi-tui/-/pi-tui-0.84.2.tgz",
diff --git a/packages/ui/src/__tests__/session-todo-panel.test.tsx b/packages/ui/src/__tests__/session-todo-panel.test.tsx
deleted file mode 100644
index 94ff4f71b2..0000000000
--- a/packages/ui/src/__tests__/session-todo-panel.test.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import assert from 'node:assert/strict';
-import { test } from 'node:test';
-import { renderToStaticMarkup } from 'react-dom/server';
-import { LocaleProvider } from '../locale-context.js';
-import { SessionTodoPanel, sessionTodoActiveCount } from '../session-todo-panel.js';
-
-test('renders the Host snapshot as one flat ordered list', () => {
- const items = [
- { content: 'First pending item', status: 'pending' as const },
- { content: 'Second completed item', status: 'completed' as const },
- { content: 'Third active item', status: 'in_progress' as const },
- ];
- assert.equal(sessionTodoActiveCount(items), 2);
-
- const markup = renderToStaticMarkup(
- <LocaleProvider locale="en">
- <SessionTodoPanel items={items} />
- </LocaleProvider>,
- );
- assert.ok(markup.indexOf('First pending item') < markup.indexOf('Second completed item'));
- assert.ok(markup.indexOf('Second completed item') < markup.indexOf('Third active item'));
- assert.equal(markup.includes('Task Create'), false);
- assert.equal(markup.includes('T1'), false);
-});
diff --git a/packages/ui/src/icons.tsx b/packages/ui/src/icons.tsx
index 7c9e29a036..31c4b9e326 100644
--- a/packages/ui/src/icons.tsx
+++ b/packages/ui/src/icons.tsx
@@ -88,6 +88,7 @@ export {
Eye,
EyeOff,
FileCode,
+ FileDiff,
FileEdit,
FileImage,
FileText,
diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts
index 9a31cf091e..267a4c1fff 100644
--- a/packages/ui/src/index.ts
+++ b/packages/ui/src/index.ts
@@ -62,7 +62,6 @@ export * from './form-interaction-prompt.js';
export * from './form-interaction-prompt-state.js';
export * from './redact.js';
export * from './thinking-stream.js';
-export * from './session-todo-panel.js';
export * from './toast.js';
export * from './tool-output-stream.js';
export * from './ui.js';
diff --git a/packages/ui/src/session-todo-panel.tsx b/packages/ui/src/session-todo-panel.tsx
deleted file mode 100644
index 35989a4116..0000000000
--- a/packages/ui/src/session-todo-panel.tsx
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { Banner, EmptyState, IconButton, Spinner } from '@astryxdesign/core';
-import type { SessionTodoItem, SessionTodoStatus } from '@maka/core/session-todo';
-import { CheckCircle2, CircleGauge, Clock, ICON_SIZE, ListTodo, RefreshCcw } from './icons.js';
-import { useUiLocale } from './locale-context.js';
-import { getSharedUiCopy } from './shared-ui-copy.js';
-
-const STATUS_ICONS = {
- pending: Clock,
- in_progress: CircleGauge,
- completed: CheckCircle2,
-} satisfies Record<SessionTodoStatus, typeof Clock>;
-
-export interface SessionTodoPanelProps {
- items: readonly SessionTodoItem[];
- loading?: boolean;
- error?: string;
- onRetry?: () => void;
-}
-
-export function sessionTodoActiveCount(items: readonly SessionTodoItem[]): number {
- return items.filter((item) => item.status !== 'completed').length;
-}
-
-/** Read-only flat projection of the Host-owned current Todo document. */
-export function SessionTodoPanel(props: SessionTodoPanelProps) {
- const copy = getSharedUiCopy(useUiLocale()).sessionTodo;
- return (
- <section className="maka-session-todo-panel" aria-label={copy.ariaLabel}>
- {props.error ? (
- <Banner
- status="error"
- role="alert"
- className="maka-session-todo-message"
- title={props.error}
- endContent={props.onRetry ? (
- <IconButton
- variant="ghost"
- size="sm"
- className="maka-session-todo-retry"
- onClick={props.onRetry}
- label={copy.retry}
- tooltip={copy.retry}
- icon={<RefreshCcw size={ICON_SIZE.control} aria-hidden="true" />}
- />
- ) : undefined}
- />
- ) : props.loading && props.items.length === 0 ? (
- <Spinner size="sm" shade="subtle" label={copy.loading} className="maka-session-todo-message" />
- ) : props.items.length === 0 ? (
- <EmptyState
- isCompact
- className="maka-session-todo-empty"
- icon={<ListTodo size={ICON_SIZE.empty} aria-hidden="true" />}
- title={copy.empty}
- />
- ) : (
- <ol className="maka-session-todo-tree" aria-label={copy.activeAriaLabel}>
- {props.items.map((item, index) => {
- const StatusIcon = STATUS_ICONS[item.status];
- return (
- <li className="maka-session-todo-row" key={`${index}:${item.status}:${item.content}`}>
- <StatusIcon size={ICON_SIZE.control} aria-hidden="true" />
- <span>{item.content}</span>
- </li>
- );
- })}
- </ol>
- )}
- </section>
- );
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org