Skip to content

Commit f76a3c5

Browse files
BunsDevvincentkoc
andauthored
feat(ui): dashboard-v2 views refactor (slice 3/3 of dashboard-v2) (#41503)
* feat(ui): add chat infrastructure modules (slice 1 of dashboard-v2) New self-contained chat modules extracted from dashboard-v2-structure: - chat/slash-commands.ts: slash command definitions and completions - chat/slash-command-executor.ts: execute slash commands via gateway RPC - chat/slash-command-executor.node.test.ts: test coverage - chat/speech.ts: speech-to-text (STT) support - chat/input-history.ts: per-session input history navigation - chat/pinned-messages.ts: pinned message management - chat/deleted-messages.ts: deleted message tracking - chat/export.ts: shared exportChatMarkdown helper - chat-export.ts: re-export shim for backwards compat Gateway fix: - Restore usage/cost stripping in chat.history sanitization - Add test coverage for sanitization behavior These modules are additive and tree-shaken — no existing code imports them yet. They will be wired in subsequent slices. * feat(ui): add utilities, theming, and i18n updates (slice 2 of dashboard-v2) UI utilities and theming improvements extracted from dashboard-v2-structure: Icons & formatting: - icons.ts: expanded icon set for new dashboard views - format.ts: date/number formatting helpers - tool-labels.ts: human-readable tool name mappings Theming: - theme.ts: enhanced theme resolution and system theme support - theme-transition.ts: simplified transition logic - storage.ts: theme parsing improvements for settings persistence Navigation & types: - navigation.ts: extended tab definitions for dashboard-v2 - app-view-state.ts: expanded view state management - types.ts: new type definitions (HealthSummary, ModelCatalogEntry, etc.) Components: - components/dashboard-header.ts: reusable header component i18n: - Updated en, pt-BR, zh-CN, zh-TW locales with new dashboard strings All changes are additive or backwards-compatible. Build passes. Part of #36853. * feat(ui): dashboard-v2 views refactor (slice 3 of dashboard-v2) Complete views refactor from dashboard-v2-structure, building on slice 1 (chat infra, #41497) and slice 2 (utilities/theming, #41500). Core app wiring: - app.ts: updated host component with new state properties - app-render.ts: refactored render pipeline for new dashboard layout - app-render.helpers.ts: extracted render helpers - app-settings.ts: theme listener lifecycle fix, cron runs on tab load - app-gateway.ts: refactored chat event handling - app-chat.ts: slash command integration New views: - views/command-palette.ts: command palette (Cmd+K) - views/login-gate.ts: authentication gate - views/bottom-tabs.ts: mobile tab navigation - views/overview-*.ts: modular overview dashboard (cards, attention, event log, hints, log tail, quick actions) - views/agents-panels-overview.ts: agent overview panel Refactored views: - views/chat.ts: major refactor with STT, slash commands, search, export, pinned messages, input history - views/config.ts: restructured config management - views/agents.ts: streamlined agent management - views/overview.ts: modular composition from sub-views - views/sessions.ts: enhanced session management Controllers: - controllers/health.ts: new health check controller - controllers/models.ts: new model catalog controller - controllers/agents.ts: tools catalog improvements - controllers/config.ts: config form enhancements Tests & infrastructure: - Updated test helpers, browser tests, node tests - vite.config.ts: build configuration updates - markdown.ts: rendering improvements Build passes ✅ | 44 files | +6,626/-1,499 Part of #36853. Depends on #41497 and #41500. * UI: fix chat review follow-ups * fix(ui): repair chat clear and attachment regressions * fix(ui): address remaining chat review comments * fix(ui): address review follow-ups * fix(ui): replay queued local slash commands * fix(ui): repair control-ui type drift * fix(ui): restore control UI styling * feat(ui): enhance layout and styling for config and topbar components - Updated grid layout for the config layout to allow full-width usage. - Introduced new styles for top tabs and search components to improve usability. - Added theme mode toggle styling for better visual integration. - Implemented tests for layout and theme mode components to ensure proper rendering and functionality. * feat(ui): add config file opening functionality and enhance styles - Implemented a new handler to open the configuration file using the default application based on the operating system. - Updated various CSS styles across components for improved visual consistency and usability, including adjustments to padding, margins, and font sizes. - Introduced new styles for the data table and sidebar components to enhance layout and interaction. - Added tests for the collapsed navigation rail to ensure proper functionality in different states. * refactor(ui): update CSS styles for improved layout and consistency - Simplified font-body declaration in base.css for cleaner code. - Adjusted transition properties in components.css for better readability. - Added new .workspace-link class in components.css for enhanced link styling. - Changed config layout from grid to flex in config.css for better responsiveness. - Updated related tests to reflect layout changes in config-layout.browser.test.ts. * feat(ui): enhance theme handling and loading states in chat interface - Updated CSS to support new theme mode attributes for better styling consistency across light and dark themes. - Introduced loading skeletons in the chat view to improve user experience during data fetching. - Refactored command palette to manage focus more effectively, enhancing accessibility. - Added tests for the appearance theme picker and loading states to ensure proper rendering and functionality. * refactor(ui): streamline ephemeral state management in chat and config views - Introduced interfaces for ephemeral state in chat and config views to encapsulate related variables. - Refactored state management to utilize a single object for better organization and maintainability. - Removed legacy state variables and updated related functions to reference the new state structure. - Enhanced readability and consistency across the codebase by standardizing state handling. * chore: remove test files to reduce PR scope * fix(ui): resolve type errors in debug props and chat search * refactor(ui): remove stream mode functionality across various components - Eliminated stream mode related translations and CSS styles to streamline the user interface. - Updated multiple components to remove references to stream mode, enhancing code clarity and maintainability. - Adjusted rendering logic in views to ensure consistent behavior without stream mode. - Improved overall readability by cleaning up unused variables and props. * fix(ui): add msg-meta CSS and fix rebase type errors * fix(ui): add CSS for chat footer action buttons (TTS, delete) and msg-meta * feat(ui): add delete confirmation with remember-decision checkbox * fix(ui): delete confirmation with remember, attention icon sizing * fix(ui): open delete confirm popover to the left (not clipped) * fix(ui): show all nav items in collapsed sidebar, remove gap * fix(ui): address P1/P2 review feedback — session queue clear, kill scope, palette guard, stop button * fix(ui): address Greptile re-review — kill scope, queue flush, idle handling, parallel fetch - SECURITY: /kill <target> now enforces session tree scope (not just /kill all) - /kill reports idle sessions gracefully instead of throwing - Queue continues draining after local slash commands - /model fetches sessions.list + models.list in parallel (perf fix) * fix(ui): style update banner close button — SVG stroke + sizing * fix(ui): update layout styles for sidebar and content spacing * UI: restore colon slash command parsing * UI: restore slash command session queries * Refactor thinking resolution: Introduce resolveThinkingDefaultForModel function and update model-selection to utilize it. Add tests for new functionality in thinking.test.ts. * fix(ui): constrain welcome state logo size, add missing CSS for new session view --------- Co-authored-by: Vincent Koc <[email protected]>
1 parent 86135d5 commit f76a3c5

73 files changed

Lines changed: 11320 additions & 3822 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,11 @@ dist/protocol.schema.json
123123
# Synthing
124124
**/.stfolder/
125125
.dev-state
126+
docs/superpowers/plans/2026-03-10-collapsed-side-nav.md
127+
docs/superpowers/specs/2026-03-10-collapsed-side-nav-design.md
128+
.gitignore
129+
test/config-form.analyze.telegram.test.ts
130+
ui/src/ui/theme-variants.browser.test.ts
131+
ui/src/ui/__screenshots__/navigation.browser.test.ts/control-UI-routing-auto-scrolls-chat-history-to-the-latest-message-1.png
132+
ui/src/ui/__screenshots__/navigation.browser.test.ts/control-UI-routing-auto-scrolls-chat-history-to-the-latest-message-1.png
133+
ui/src/ui/__screenshots__/navigation.browser.test.ts/control-UI-routing-auto-scrolls-chat-history-to-the-latest-message-1.png

src/agents/model-selection.ts

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { resolveThinkingDefaultForModel } from "../auto-reply/thinking.js";
12
import type { OpenClawConfig } from "../config/config.js";
23
import {
34
resolveAgentModelFallbackValues,
@@ -36,7 +37,6 @@ const ANTHROPIC_MODEL_ALIASES: Record<string, string> = {
3637
"sonnet-4.6": "claude-sonnet-4-6",
3738
"sonnet-4.5": "claude-sonnet-4-5",
3839
};
39-
const CLAUDE_46_MODEL_RE = /claude-(?:opus|sonnet)-4(?:\.|-)6(?:$|[-.])/i;
4040

4141
function normalizeAliasKey(value: string): string {
4242
return value.trim().toLowerCase();
@@ -629,8 +629,8 @@ export function resolveThinkingDefault(params: {
629629
model: string;
630630
catalog?: ModelCatalogEntry[];
631631
}): ThinkLevel {
632-
const normalizedProvider = normalizeProviderId(params.provider);
633-
const modelLower = params.model.toLowerCase();
632+
const _normalizedProvider = normalizeProviderId(params.provider);
633+
const _modelLower = params.model.toLowerCase();
634634
const configuredModels = params.cfg.agents?.defaults?.models;
635635
const canonicalKey = modelKey(params.provider, params.model);
636636
const legacyKey = legacyModelKey(params.provider, params.model);
@@ -652,21 +652,11 @@ export function resolveThinkingDefault(params: {
652652
if (configured) {
653653
return configured;
654654
}
655-
const isAnthropicFamilyModel =
656-
normalizedProvider === "anthropic" ||
657-
normalizedProvider === "amazon-bedrock" ||
658-
modelLower.includes("anthropic/") ||
659-
modelLower.includes(".anthropic.");
660-
if (isAnthropicFamilyModel && CLAUDE_46_MODEL_RE.test(modelLower)) {
661-
return "adaptive";
662-
}
663-
const candidate = params.catalog?.find(
664-
(entry) => entry.provider === params.provider && entry.id === params.model,
665-
);
666-
if (candidate?.reasoning) {
667-
return "low";
668-
}
669-
return "off";
655+
return resolveThinkingDefaultForModel({
656+
provider: params.provider,
657+
model: params.model,
658+
catalog: params.catalog,
659+
});
670660
}
671661

672662
/** Default reasoning level when session/directive do not set it: "on" if model supports reasoning, else "off". */

src/auto-reply/thinking.test.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
listThinkingLevels,
55
normalizeReasoningLevel,
66
normalizeThinkLevel,
7+
resolveThinkingDefaultForModel,
78
} from "./thinking.js";
89

910
describe("normalizeThinkLevel", () => {
@@ -84,6 +85,40 @@ describe("listThinkingLevelLabels", () => {
8485
});
8586
});
8687

88+
describe("resolveThinkingDefaultForModel", () => {
89+
it("defaults Claude 4.6 models to adaptive", () => {
90+
expect(
91+
resolveThinkingDefaultForModel({ provider: "anthropic", model: "claude-opus-4-6" }),
92+
).toBe("adaptive");
93+
});
94+
95+
it("treats Bedrock Anthropic aliases as adaptive", () => {
96+
expect(
97+
resolveThinkingDefaultForModel({ provider: "aws-bedrock", model: "claude-sonnet-4-6" }),
98+
).toBe("adaptive");
99+
});
100+
101+
it("defaults reasoning-capable catalog models to low", () => {
102+
expect(
103+
resolveThinkingDefaultForModel({
104+
provider: "openai",
105+
model: "gpt-5.4",
106+
catalog: [{ provider: "openai", id: "gpt-5.4", reasoning: true }],
107+
}),
108+
).toBe("low");
109+
});
110+
111+
it("defaults to off when no adaptive or reasoning hint is present", () => {
112+
expect(
113+
resolveThinkingDefaultForModel({
114+
provider: "openai",
115+
model: "gpt-4.1-mini",
116+
catalog: [{ provider: "openai", id: "gpt-4.1-mini", reasoning: false }],
117+
}),
118+
).toBe("off");
119+
});
120+
});
121+
87122
describe("normalizeReasoningLevel", () => {
88123
it("accepts on/off", () => {
89124
expect(normalizeReasoningLevel("on")).toBe("on");

src/auto-reply/thinking.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ export type ElevatedLevel = "off" | "on" | "ask" | "full";
55
export type ElevatedMode = "off" | "ask" | "full";
66
export type ReasoningLevel = "off" | "on" | "stream";
77
export type UsageDisplayLevel = "off" | "tokens" | "full";
8+
export type ThinkingCatalogEntry = {
9+
provider: string;
10+
id: string;
11+
reasoning?: boolean;
12+
};
13+
14+
const CLAUDE_46_MODEL_RE = /claude-(?:opus|sonnet)-4(?:\.|-)6(?:$|[-.])/i;
815

916
function normalizeProviderId(provider?: string | null): string {
1017
if (!provider) {
@@ -14,6 +21,9 @@ function normalizeProviderId(provider?: string | null): string {
1421
if (normalized === "z.ai" || normalized === "z-ai") {
1522
return "zai";
1623
}
24+
if (normalized === "bedrock" || normalized === "aws-bedrock") {
25+
return "amazon-bedrock";
26+
}
1727
return normalized;
1828
}
1929

@@ -130,6 +140,30 @@ export function formatXHighModelHint(): string {
130140
return `${refs.slice(0, -1).join(", ")} or ${refs[refs.length - 1]}`;
131141
}
132142

143+
export function resolveThinkingDefaultForModel(params: {
144+
provider: string;
145+
model: string;
146+
catalog?: ThinkingCatalogEntry[];
147+
}): ThinkLevel {
148+
const normalizedProvider = normalizeProviderId(params.provider);
149+
const modelLower = params.model.trim().toLowerCase();
150+
const isAnthropicFamilyModel =
151+
normalizedProvider === "anthropic" ||
152+
normalizedProvider === "amazon-bedrock" ||
153+
modelLower.includes("anthropic/") ||
154+
modelLower.includes(".anthropic.");
155+
if (isAnthropicFamilyModel && CLAUDE_46_MODEL_RE.test(modelLower)) {
156+
return "adaptive";
157+
}
158+
const candidate = params.catalog?.find(
159+
(entry) => entry.provider === params.provider && entry.id === params.model,
160+
);
161+
if (candidate?.reasoning) {
162+
return "low";
163+
}
164+
return "off";
165+
}
166+
133167
type OnOffFullLevel = "off" | "on" | "full";
134168

135169
function normalizeOnOffFullLevel(raw?: string | null): OnOffFullLevel | undefined {

src/config/zod-schema.providers-core.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ export const TelegramDirectSchema = z
104104

105105
const TelegramCustomCommandSchema = z
106106
.object({
107-
command: z.string().transform(normalizeTelegramCommandName),
108-
description: z.string().transform(normalizeTelegramCommandDescription),
107+
command: z.string().overwrite(normalizeTelegramCommandName),
108+
description: z.string().overwrite(normalizeTelegramCommandDescription),
109109
})
110110
.strict();
111111

src/gateway/server-methods/config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { exec } from "node:child_process";
12
import { resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../../agents/agent-scope.js";
23
import { listChannelPlugins } from "../../channels/plugins/index.js";
34
import {
@@ -529,4 +530,19 @@ export const configHandlers: GatewayRequestHandlers = {
529530
undefined,
530531
);
531532
},
533+
"config.openFile": ({ params, respond }) => {
534+
if (!assertValidParams(params, validateConfigGetParams, "config.openFile", respond)) {
535+
return;
536+
}
537+
const configPath = createConfigIO().configPath;
538+
const platform = process.platform;
539+
const cmd = platform === "darwin" ? "open" : platform === "win32" ? "start" : "xdg-open";
540+
exec(`${cmd} ${JSON.stringify(configPath)}`, (err) => {
541+
if (err) {
542+
respond(true, { ok: false, path: configPath, error: err.message }, undefined);
543+
return;
544+
}
545+
respond(true, { ok: true, path: configPath }, undefined);
546+
});
547+
},
532548
};

ui/src/i18n/locales/en.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { TranslationMap } from "../lib/types.ts";
22

33
export const en: TranslationMap = {
44
common: {
5-
version: "Version",
65
health: "Health",
76
ok: "OK",
87
offline: "Offline",
@@ -147,18 +146,14 @@ export const en: TranslationMap = {
147146
refreshAll: "Refresh All",
148147
terminal: "Terminal",
149148
},
150-
streamMode: {
151-
active: "Stream mode — values redacted",
152-
disable: "Disable",
153-
},
154149
palette: {
155150
placeholder: "Type a command…",
156151
noResults: "No results",
157152
},
158153
},
159154
login: {
160155
subtitle: "Gateway Dashboard",
161-
passwordPlaceholder: "optional", // pragma: allowlist secret
156+
passwordPlaceholder: "optional",
162157
},
163158
chat: {
164159
disconnected: "Disconnected from gateway.",

ui/src/i18n/locales/pt-BR.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { TranslationMap } from "../lib/types.ts";
22

33
export const pt_BR: TranslationMap = {
44
common: {
5-
version: "Versão",
65
health: "Saúde",
76
ok: "OK",
87
offline: "Offline",
@@ -12,7 +11,6 @@ export const pt_BR: TranslationMap = {
1211
disabled: "Desativado",
1312
na: "n/a",
1413
docs: "Docs",
15-
theme: "Tema",
1614
resources: "Recursos",
1715
search: "Pesquisar",
1816
},
@@ -149,18 +147,14 @@ export const pt_BR: TranslationMap = {
149147
refreshAll: "Atualizar Tudo",
150148
terminal: "Terminal",
151149
},
152-
streamMode: {
153-
active: "Modo stream — valores ocultos",
154-
disable: "Desativar",
155-
},
156150
palette: {
157151
placeholder: "Digite um comando…",
158152
noResults: "Sem resultados",
159153
},
160154
},
161155
login: {
162156
subtitle: "Painel do Gateway",
163-
passwordPlaceholder: "opcional", // pragma: allowlist secret
157+
passwordPlaceholder: "opcional",
164158
},
165159
chat: {
166160
disconnected: "Desconectado do gateway.",

ui/src/i18n/locales/zh-CN.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { TranslationMap } from "../lib/types.ts";
22

33
export const zh_CN: TranslationMap = {
44
common: {
5-
version: "版本",
65
health: "健康状况",
76
ok: "正常",
87
offline: "离线",
@@ -12,7 +11,6 @@ export const zh_CN: TranslationMap = {
1211
disabled: "已禁用",
1312
na: "不适用",
1413
docs: "文档",
15-
theme: "主题",
1614
resources: "资源",
1715
search: "搜索",
1816
},
@@ -146,10 +144,6 @@ export const zh_CN: TranslationMap = {
146144
refreshAll: "全部刷新",
147145
terminal: "终端",
148146
},
149-
streamMode: {
150-
active: "流模式 — 数据已隐藏",
151-
disable: "禁用",
152-
},
153147
palette: {
154148
placeholder: "输入命令…",
155149
noResults: "无结果",

ui/src/i18n/locales/zh-TW.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { TranslationMap } from "../lib/types.ts";
22

33
export const zh_TW: TranslationMap = {
44
common: {
5-
version: "版本",
65
health: "健康狀況",
76
ok: "正常",
87
offline: "離線",
@@ -12,7 +11,6 @@ export const zh_TW: TranslationMap = {
1211
disabled: "已禁用",
1312
na: "不適用",
1413
docs: "文檔",
15-
theme: "主題",
1614
resources: "資源",
1715
search: "搜尋",
1816
},
@@ -146,10 +144,6 @@ export const zh_TW: TranslationMap = {
146144
refreshAll: "全部刷新",
147145
terminal: "終端",
148146
},
149-
streamMode: {
150-
active: "串流模式 — 數據已隱藏",
151-
disable: "禁用",
152-
},
153147
palette: {
154148
placeholder: "輸入指令…",
155149
noResults: "無結果",

0 commit comments

Comments
 (0)