diff --git a/decnet_web/src/components/RealismConfig/RealismConfig.tsx b/decnet_web/src/components/RealismConfig/RealismConfig.tsx index 042453aa..69834e3c 100644 --- a/decnet_web/src/components/RealismConfig/RealismConfig.tsx +++ b/decnet_web/src/components/RealismConfig/RealismConfig.tsx @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'; import api from '../../utils/api'; import { useToast } from '../Toasts/useToast'; import { Sliders, Save, RotateCcw } from '../../icons'; +import { contentClassLabel, isCanaryClass } from '../../realism/labels'; // ─── Types ─────────────────────────────────────────────────────────────────── @@ -70,8 +71,15 @@ const WeightTable: React.FC<{ {weights.map((w, i) => ( - - {w.content_class} + + + {contentClassLabel(w.content_class)} + + + {w.content_class} + = ({ uuid, deckies, onClose }) <>
PERSONA
{row.persona}
-
CONTENT CLASS
{row.content_class}
+
CONTENT CLASS
+
+ + {contentClassLabel(row.content_class)} + + + {row.content_class} + +
EDIT COUNT
{row.edit_count}
CREATED
{fmt(row.created_at)}
LAST MODIFIED
{fmt(row.last_modified)}
@@ -282,7 +291,7 @@ const SyntheticFiles: React.FC = () => { > {CONTENT_CLASSES.map((c) => ( - + ))} @@ -322,7 +331,12 @@ const SyntheticFiles: React.FC = () => { {deckyLabel(r.decky_uuid, deckies)} {r.path} {r.persona} - {r.content_class} + + {contentClassLabel(r.content_class)} + {fmt(r.last_modified)} {r.edit_count} {r.content_hash.slice(0, 12)}… diff --git a/decnet_web/src/realism/labels.ts b/decnet_web/src/realism/labels.ts new file mode 100644 index 00000000..d01ff949 --- /dev/null +++ b/decnet_web/src/realism/labels.ts @@ -0,0 +1,39 @@ +/* Human-readable labels for realism content classes. + * + * Source of truth for the enum values is decnet/realism/taxonomy.py. + * This module is the only place display text lives — every UI surface + * that renders a content_class should call ``contentClassLabel(value)`` + * so the label vocabulary stays consistent across the dashboard. */ + +const LABELS: Record = { + // User classes — files written by personas during work hours. + note: 'Note', + todo: 'TODO List', + draft: 'Draft Document', + script: 'Shell / Python Script', + + // System classes — plausible OS-side filler. + log_cron: 'Cron Log', + log_daemon: 'Daemon Log', + cache_tmp: 'Cache / Temp File', + + // Canary classes — callback-bearing artifacts. + canary_aws_creds: 'Canary · AWS Credentials', + canary_env_file: 'Canary · .env File', + canary_git_config: 'Canary · git config', + canary_ssh_key: 'Canary · SSH Private Key', + canary_honeydoc: 'Canary · HTML Honeydoc', + canary_honeydoc_docx: 'Canary · DOCX Honeydoc', + canary_honeydoc_pdf: 'Canary · PDF Honeydoc', + canary_mysql_dump: 'Canary · MySQL Dump', +}; + +export function contentClassLabel(value: string): string { + return LABELS[value] ?? value; +} + +/* Returns true when the value is a canary class. Used to style canary + * rows differently in tables (subtle red accent, etc). */ +export function isCanaryClass(value: string): boolean { + return value.startsWith('canary_'); +}