Skip to content

The agent that grows with you

fix(dashboard): show broken links as non-actionable entries in Files page

Austin Pickett3225f357a57d
diff --git a/web/src/lib/api-files.ts b/web/src/lib/api-files.ts
new file mode 100644
index 00000000000..89f1825a6a0
--- /dev/null
+++ b/web/src/lib/api-files.ts
@@ -0,0 +1,42 @@
+// Managed-files API types for the dashboard Files page. Moved out of api.ts so
+// that facade stays under its code-health line cap (the interfaces keep their
+// own cap here, per AGENTS.md § code health ratchet).
+
+export interface ManagedFileEntry {
+ name: string;
+ path: string;
+ is_directory: boolean;
+ broken_link?: boolean;
+ size: number | null;
+ mtime: number | null;
+ mime_type: string | null;
+}
+
+export interface ManagedFilesResponse {
+ root: string | null;
+ path: string;
+ parent: string | null;
+ locked_root: string | null;
+ can_change_path: boolean;
+ entries: ManagedFileEntry[];
+}
+
+export interface ManagedFileReadResponse {
+ name: string;
+ path: string;
+ size: number;
+ mime_type: string;
+ data_url: string;
+ root: string | null;
+ locked_root: string | null;
+ can_change_path: boolean;
+}
+
+export interface ManagedFileWriteResponse {
+ ok: boolean;
+ path: string;
+ entry: ManagedFileEntry;
+ root: string | null;
+ locked_root: string | null;
+ can_change_path: boolean;
+}
diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts
index bbbf311e699..e8dfe43ced9 100644
--- a/web/src/lib/api.ts
+++ b/web/src/lib/api.ts
@@ -5,6 +5,11 @@ import {
} from "@hermes/shared";
import type { AuxiliaryModelsResponse } from "./api-aux";
+import type {
+ ManagedFileReadResponse,
+ ManagedFilesResponse,
+ ManagedFileWriteResponse,
+} from "./api-files";
import { dashboardServingProfile } from "./profile-bootstrap";
// The dashboard can be served either at the root of its host (e.g.
@@ -2251,43 +2256,12 @@ export interface LogsResponse {
lines: string[];
}
-export interface ManagedFileEntry {
- name: string;
- path: string;
- is_directory: boolean;
- size: number | null;
- mtime: number;
- mime_type: string | null;
-}
-
-export interface ManagedFilesResponse {
- root: string | null;
- path: string;
- parent: string | null;
- locked_root: string | null;
- can_change_path: boolean;
- entries: ManagedFileEntry[];
-}
-
-export interface ManagedFileReadResponse {
- name: string;
- path: string;
- size: number;
- mime_type: string;
- data_url: string;
- root: string | null;
- locked_root: string | null;
- can_change_path: boolean;
-}
-
-export interface ManagedFileWriteResponse {
- ok: boolean;
- path: string;
- entry: ManagedFileEntry;
- root: string | null;
- locked_root: string | null;
- can_change_path: boolean;
-}
+export type {
+ ManagedFileEntry,
+ ManagedFileReadResponse,
+ ManagedFilesResponse,
+ ManagedFileWriteResponse,
+} from "./api-files";
export interface AnalyticsDailyEntry {
day: string;
diff --git a/web/src/pages/FilesPage.tsx b/web/src/pages/FilesPage.tsx
index c288878efb8..15b13a5bf97 100644
--- a/web/src/pages/FilesPage.tsx
+++ b/web/src/pages/FilesPage.tsx
@@ -14,6 +14,7 @@ import {
FolderPlus,
RefreshCw,
Trash2,
+ Unlink,
Upload,
} from "lucide-react";
import { Badge } from "@nous-research/ui/ui/components/badge";
@@ -237,7 +238,7 @@ export default function FilesPage() {
};
const downloadFile = async (entry: ManagedFileEntry) => {
- if (entry.is_directory) return;
+ if (entry.is_directory || entry.broken_link) return;
try {
const file = await api.readFile(entry.path);
downloadDataUrl(file.data_url, file.name);
@@ -404,18 +405,29 @@ export default function FilesPage() {
<button
type="button"
onClick={() => (entry.is_directory ? openDirectory(entry) : void downloadFile(entry))}
- className="flex min-w-0 items-center gap-2 text-left font-mono text-foreground"
+ disabled={entry.broken_link}
+ title={entry.broken_link ? "Broken symbolic link" : undefined}
+ className="flex min-w-0 items-center gap-2 text-left font-mono text-foreground disabled:cursor-not-allowed disabled:text-text-tertiary"
>
{entry.is_directory ? (
<Folder className="h-4 w-4 shrink-0 text-warning" />
+ ) : entry.broken_link ? (
+ <Unlink className="h-4 w-4 shrink-0 text-destructive" />
) : (
<FileIcon className="h-4 w-4 shrink-0 text-text-tertiary" />
)}
<span className="truncate">{entry.name}</span>
+ {entry.broken_link && (
+ <Badge tone="destructive" className="shrink-0 text-xs">
+ Broken link
+ </Badge>
+ )}
</button>
<span className="text-xs tabular-nums text-text-secondary">{formatBytes(entry.size)}</span>
<span className="truncate text-xs text-text-secondary">
- {Number.isFinite(entry.mtime) ? DATE_FORMAT.format(entry.mtime * 1000) : "-"}
+ {entry.mtime !== null && Number.isFinite(entry.mtime)
+ ? DATE_FORMAT.format(entry.mtime * 1000)
+ : "-"}
</span>
<span className="flex justify-end gap-1">
{entry.is_directory ? (
@@ -434,6 +446,7 @@ export default function FilesPage() {
size="icon"
type="button"
onClick={() => void downloadFile(entry)}
+ disabled={entry.broken_link}
aria-label={`Download ${entry.name}`}
>
<Download />