// doctrine-scanner-exempt: legacy live-product surface; rename tracked as separate engineering debt — see scripts/check-doctrine-v6.mjs header. import { useState } from 'react'; import { Link } from 'wouter'; import { AMARU_AGENTS, RELAY_MAPPINGS, RELAY_MODELS, RELAY_DESTINATIONS, RELAY_POLICIES, RELAY_SOURCES } from '@/data/fabric'; import type { AmaruAgent } from '@/data/fabric/types'; import { runCoalition, parseDslRules } from '@/lib/agentic'; import { FabricHeader, FabricStat, FabricCard, FabricDrawer, MicroBar, SeverityChip } from '@/components/fabric/primitives'; import { Badge, Button, Select } from '@/components/ui'; import { useInnovationStore, applyMappingOverrides } from '@/lib/innovation-store'; import { Settings } from 'lucide-react'; import { AtelierEmbedFrame } from '@/components/AtelierEmbedFrame'; export default function AgentsPage() { const { mapperStats, dslVersions, mappingOverrides, goldenMerges } = useInnovationStore(); const [drawerId, setDrawerId] = useState(null); const [mappingId, setMappingId] = useState(RELAY_MAPPINGS[0]?.id ?? ''); const [seed, setSeed] = useState(42); const [run, setRun] = useState | null>(null); const activeDsl = dslVersions[0] ?? null; const activeDslRules = activeDsl ? parseDslRules(activeDsl.content) : []; const drawer = drawerId ? AMARU_AGENTS.find((a) => a.id === drawerId)! : null; const trigger = () => { const seedMapping = RELAY_MAPPINGS.find((mp) => mp.id === mappingId); if (!seedMapping) return; // Apply approved drift repairs to the mapping definition before handing // it to the coalition, so the run reflects the repaired field set, // transformations, and any governance promotion. const m = applyMappingOverrides(seedMapping, mappingOverrides); const model = RELAY_MODELS.find((mo) => mo.id === m.modelId); const dest = RELAY_DESTINATIONS.find((d) => d.id === m.destinationId); const src = model ? RELAY_SOURCES.find((s) => s.id === model.sourceId) : undefined; if (!model || !dest || !src) return; const goldenIdentity = goldenMerges[0]?.entityName; setRun(runCoalition({ mapping: m, model, destination: dest, source: src, policies: RELAY_POLICIES, seed, nowIso: '2026-05-05T03:55:00Z', dslRules: activeDslRules, dslVersion: activeDsl?.version, goldenMergeCount: goldenMerges.length, goldenIdentity, })); }; return (
replay setSeed(Number(e.target.value))} className="w-16 h-9 rounded-md bg-transparent border border-input px-2 text-sm" />
} />
s + a.recentDecisionCount, 0).toLocaleString()} /> s + a.recentBlockCount, 0)} tone="warn" /> s + a.approvalRate, 0) / AMARU_AGENTS.length) * 100)}%`} tone="good" /> = 0.8 ? 'good' : 'warn'} sub={mapperStats ? `${mapperStats.totalDecided} calibrated · θ=${mapperStats.threshold.toFixed(2)}` : 'no calibration data'} />
{mapperStats && (
Mapper calibration loop active {mapperStats.accepted} accepted · {mapperStats.rejected} rejected · θ={mapperStats.threshold.toFixed(2)}
View calibration →
)}
{AMARU_AGENTS.map((a: AmaruAgent) => ( ))}
{run && ( Σ {(run.sigma.sigma * 100).toFixed(1)}%}>
P
{(run.sigma.axes.P * 100).toFixed(0)}%
K
{(run.sigma.axes.K * 100).toFixed(0)}%
Φ
{(run.sigma.axes.phi * 100).toFixed(0)}%
C
{(run.sigma.axes.C * 100).toFixed(0)}%
{run.events.map((e) => (
{e.type} {e.summary}
{e.stateHash}
))}
)} setDrawerId(null)} title={drawer?.name ?? ''} subtitle={drawer?.role}> {drawer && ( <>
RESPONSIBILITIES
    {drawer.responsibilities.map((r, i) =>
  • · {r}
  • )}
ALLOWED
    {drawer.allowedActions.map((a, i) =>
  • · {a}
  • )}
BLOCKED
    {drawer.blockedActions.map((a, i) =>
  • · {a}
  • )}
GOVERNANCE LIMITS
    {drawer.governanceLimits.map((g, i) =>
  • · {g}
  • )}
I/O CONTRACTS
in: {drawer.inputs.join(', ')}
out: {drawer.outputs.join(', ')}
)}
CROSS-SPACE COMPOSITION · A11OY ATELIER
This Atelier Space runs inside Amaru under its own Constitution and emits proofs back to the public ledger. Telemetry from this embed feeds the governance-weighted leaderboard.
); }