Make chat and transcript thinking traces readable when providers emit headings without body content. - Inline body-less headings instead of rendering empty accordion sections. - Add raw trace and section controls with localized labels across chat surfaces. - Update styling, documentation, locale resources, and regression coverage. Files changed: .changeset/fn-177-thinking-trace-empty-sections.md | 7 ++ docs/dashboard-guide.md | 2 +- .../app/components/StandardChatSurface.tsx | 2 +- packages/dashboard/app/components/TaskChatTab.tsx | 2 +- .../dashboard/app/components/ThinkingTrace.css | 5 +- .../dashboard/app/components/ThinkingTrace.tsx | 74 ++++++++--- .../app/components/WorkflowResultsTab.tsx | 2 +- .../MilestoneSliceInterviewModal.test.tsx | 22 +++ .../__tests__/MissionInterviewModal.test.tsx | 14 ++ .../PlanningModeModal.planning-flow.test.tsx | 26 +++ .../app/components/__tests__/TaskChatTab.test.tsx | 19 +++ .../__tests__/ThinkingTrace.host-inventory.test.ts | 42 +++++ .../__tests__/ThinkingTrace.surfaces.test.tsx | 96 +++++++++++++- .../components/__tests__/ThinkingTrace.test.tsx | 136 ++++++++++++++------- .../components/__tests__/WorkflowResultsTab.test.tsx | 9 ++ packages/dashboard/app/test/cssFixture.ts | 8 ++ packages/i18n/locales/en/app.json | 2 + packages/i18n/locales/es/app.json | 4 +- packages/i18n/locales/fr/app.json | 4 +- packages/i18n/locales/ko/app.json | 4 +- packages/i18n/locales/pt-BR/app.json | 4 +- packages/i18n/locales/zh-CN/app.json | 4 +- packages/i18n/locales/zh-TW/app.json | 4 +- packages/i18n/src/resources.d.ts | 2 + 24 files changed, 415 insertions(+), 79 deletions(-) Fusion-Task-Id: FN-177 Fusion-Task-Lineage: 5fa5a228-339c-4e7b-8b0e-f2eb4fdcacce Co-authored-by: Fusion <noreply@runfusion.ai>
95 lines
3.5 KiB
TypeScript
95 lines
3.5 KiB
TypeScript
import { readFileSync, readdirSync } from "node:fs";
|
|
import { join, resolve } from "node:path";
|
|
|
|
const APP_DIR = resolve(__dirname, "..");
|
|
const COMPONENTS_DIR = join(APP_DIR, "components");
|
|
|
|
/**
|
|
* FNXC:DashboardTests 2026-07-26-06:10:
|
|
* Dashboard test source reads MUST resolve from this module-relative app directory. Cwd-relative reads hard-crash an entire Vitest suite at import time under root-anchored invocations with ENOENT for paths such as app/components/QuickEntryBox.css.
|
|
*/
|
|
export function readAppFile(appRelativePath: string): string {
|
|
return readFileSync(resolve(APP_DIR, appRelativePath), "utf-8");
|
|
}
|
|
|
|
export function loadComponentCss(name: string): string {
|
|
return readAppFile(join("components", name));
|
|
}
|
|
|
|
export function listComponentFiles(directory = COMPONENTS_DIR, prefix = ""): string[] {
|
|
return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
|
|
const relativePath = `${prefix}${entry.name}`;
|
|
if (entry.isDirectory()) return listComponentFiles(join(directory, entry.name), `${relativePath}/`);
|
|
return entry.isFile() && entry.name.endsWith(".tsx") ? [relativePath] : [];
|
|
}).sort();
|
|
}
|
|
|
|
let cached: string | null = null;
|
|
let stylesCached: string | null = null;
|
|
let themeDataCached: string | null = null;
|
|
let baseOnlyCached: string | null = null;
|
|
|
|
export function loadStylesCss(): string {
|
|
if (stylesCached !== null) return stylesCached;
|
|
stylesCached = readFileSync(join(APP_DIR, "styles.css"), "utf-8");
|
|
return stylesCached;
|
|
}
|
|
|
|
export function loadThemeDataCss(): string {
|
|
if (themeDataCached !== null) return themeDataCached;
|
|
themeDataCached = readFileSync(join(APP_DIR, "public", "theme-data.css"), "utf-8");
|
|
return themeDataCached;
|
|
}
|
|
|
|
export function loadAllAppCss(): string {
|
|
if (cached !== null) return cached;
|
|
// styles.css first (preserves all section-marker positions for legacy slice
|
|
// tests), then component CSS files in alphabetical order. This keeps both
|
|
// styles.css's intra-file order intact AND lets co-located component base
|
|
// rules be matched before any cross-file @media override referencing them.
|
|
// NOTE: public/theme-data.css is intentionally excluded here; tests that
|
|
// validate per-color-theme contracts should load it explicitly.
|
|
const parts: string[] = [loadStylesCss()];
|
|
const entries = readdirSync(COMPONENTS_DIR, { withFileTypes: true })
|
|
.filter((e) => e.isFile() && e.name.endsWith(".css"))
|
|
.map((e) => e.name)
|
|
.sort();
|
|
for (const name of entries) {
|
|
parts.push(readFileSync(join(COMPONENTS_DIR, name), "utf-8"));
|
|
}
|
|
cached = parts.join("\n");
|
|
return cached;
|
|
}
|
|
|
|
/**
|
|
* Returns the combined CSS with all @media (and other at-rule) blocks
|
|
* stripped out. Useful for tests that need to match a selector's BASE rule
|
|
* (top-level, not inside a media query) and want to avoid false matches
|
|
* against @media overrides that happen to come earlier in the source order.
|
|
*/
|
|
export function loadAllAppCssBaseOnly(): string {
|
|
if (baseOnlyCached !== null) return baseOnlyCached;
|
|
const src = loadAllAppCss();
|
|
// Walk and excise any top-level @<rule> { ... } block (e.g. @media, @supports)
|
|
let out = "";
|
|
let i = 0;
|
|
while (i < src.length) {
|
|
if (src[i] === "@") {
|
|
const open = src.indexOf("{", i);
|
|
if (open === -1) { out += src.slice(i); break; }
|
|
let depth = 1;
|
|
let j = open + 1;
|
|
while (j < src.length && depth > 0) {
|
|
if (src[j] === "{") depth++;
|
|
else if (src[j] === "}") depth--;
|
|
j++;
|
|
}
|
|
i = j;
|
|
continue;
|
|
}
|
|
out += src[i++];
|
|
}
|
|
baseOnlyCached = out;
|
|
return baseOnlyCached;
|
|
}
|