2sagaco48 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/diagnostics.mjs +141 -0
- package/dist/compute.worker-j5ahIpF-.js +1 -0
- package/dist/graph.worker-DG6iGCB9.js +1 -0
- package/dist/index.html +2314 -0
- package/flatten-guide.md +248 -0
- package/index.html +12 -0
- package/package.json +38 -0
- package/src/App.orig.tsx +204 -0
- package/src/App.orig1.tsx +27 -0
- package/src/App.orig2.tsx +25 -0
- package/src/App.tsx +3 -0
- package/src/BaseApp.tsx +18 -0
- package/src/INTEGRATION_LEDGER.md +22 -0
- package/src/PERSIST_CANARY.orig.txt +1 -0
- package/src/PERSIST_CANARY.txt +1 -0
- package/src/REGRESSION_LEDGER.md +651 -0
- package/src/TEMPLATE_PIPELINE_AUDIT.md +208 -0
- package/src/WILLIAMS_PERSONA_GUIDE.md +62 -0
- package/src/chat/VeritasChat.tsx +69 -0
- package/src/chat/synthesis.ts +31 -0
- package/src/chat/tier.ts +45 -0
- package/src/components/AdaptersPage.orig.tsx +99 -0
- package/src/components/AdaptersPage.tsx +3 -0
- package/src/components/AdversarialPanel.tsx +136 -0
- package/src/components/AnchorBaselinePanel.tsx +75 -0
- package/src/components/AnswerPanel.tsx +60 -0
- package/src/components/ArtifactPanel.tsx +43 -0
- package/src/components/ChatApp.orig.tsx +1582 -0
- package/src/components/ChatApp.orig1.tsx +722 -0
- package/src/components/ChatApp.tsx +95 -0
- package/src/components/ChatAugmentPanels.tsx +73 -0
- package/src/components/CitationLedgerPanel.tsx +313 -0
- package/src/components/ComputeSandboxPanel.tsx +130 -0
- package/src/components/ConfigPanel.tsx +110 -0
- package/src/components/ControlPlanePage.tsx +195 -0
- package/src/components/CreativeTreeLifePage.tsx +234 -0
- package/src/components/CreativeTreeOfLifePanel.tsx +149 -0
- package/src/components/DebugTracePanel.tsx +137 -0
- package/src/components/DeepReasoningTrace.tsx +48 -0
- package/src/components/EntitySheetPanel.tsx +51 -0
- package/src/components/FailureModesPanel.tsx +104 -0
- package/src/components/GBSDashboard.tsx +239 -0
- package/src/components/GraphView.tsx +116 -0
- package/src/components/HUD.tsx +125 -0
- package/src/components/HypothesisPanel.tsx +67 -0
- package/src/components/InnovationGenomeEngine.tsx +792 -0
- package/src/components/InnovationPersonaGuide.tsx +348 -0
- package/src/components/InnovationPersonaPanel.tsx +289 -0
- package/src/components/LiveResourceHUD.tsx +109 -0
- package/src/components/LongWriterPanel.tsx +112 -0
- package/src/components/MainPipelineV10Bridge.tsx +72 -0
- package/src/components/MarkdownLite.tsx +63 -0
- package/src/components/MemoryInspector.tsx +38 -0
- package/src/components/MemoryMonitor.tsx +52 -0
- package/src/components/MemoryStressPanel.tsx +176 -0
- package/src/components/ModulesPage.tsx +171 -0
- package/src/components/PipelineDebugConsole.orig.tsx +1856 -0
- package/src/components/PipelineDebugConsole.tsx +3 -0
- package/src/components/PreFlightHUD.tsx +67 -0
- package/src/components/PrismaFetchTracePanel.tsx +87 -0
- package/src/components/ReportOSPanel.tsx +165 -0
- package/src/components/ResourceEstimatorPage.tsx +327 -0
- package/src/components/RichText.tsx +181 -0
- package/src/components/SagaOsPanel.tsx +605 -0
- package/src/components/SagaOsReference.tsx +421 -0
- package/src/components/SagaOsV2Panel.tsx +594 -0
- package/src/components/SagaStyleTab.tsx +382 -0
- package/src/components/SageBlueprintPanel.tsx +416 -0
- package/src/components/SharedChatInput.tsx +77 -0
- package/src/components/StatFinancePanel.tsx +190 -0
- package/src/components/StylePersonaPanel.tsx +128 -0
- package/src/components/TemplatesPage.tsx +300 -0
- package/src/components/TestPanel.tsx +63 -0
- package/src/components/TraceLog.tsx +89 -0
- package/src/components/V15CalibrationAugment.tsx +1134 -0
- package/src/components/V15CalibrationDialog.tsx +1871 -0
- package/src/components/V15Overlay.orig.tsx +120 -0
- package/src/components/V15Overlay.tsx +4 -0
- package/src/components/V15OverlayWrapper.tsx +362 -0
- package/src/components/V15Toggle.tsx +34 -0
- package/src/console/DiagnosticRecoveryPanel.tsx +358 -0
- package/src/console/EngineeringConsole.tsx +103 -0
- package/src/console/FictionSystemPanels.tsx +882 -0
- package/src/console/InspectorPanels.tsx +254 -0
- package/src/console/ManuscriptGraderPanel.tsx +182 -0
- package/src/console/RecursiveReviserPanel.tsx +245 -0
- package/src/console/SeedControlPanel.tsx +135 -0
- package/src/console/StoryControllerPanel.tsx +443 -0
- package/src/console/engineBridge.ts +258 -0
- package/src/console/gemini.ts +106 -0
- package/src/console/grading.ts +250 -0
- package/src/console/util.ts +45 -0
- package/src/fiction/continuity.ts +372 -0
- package/src/fiction/crash-protection.ts +111 -0
- package/src/fiction/diagnostics.ts +208 -0
- package/src/fiction/diff.ts +74 -0
- package/src/fiction/entity-state-machine.ts +214 -0
- package/src/fiction/nive-engine.ts +404 -0
- package/src/fiction/pipeline-selftest.ts +132 -0
- package/src/fiction/seed-control.ts +193 -0
- package/src/fiction/story-engine.ts +326 -0
- package/src/fiction/types.ts +68 -0
- package/src/flatten-guide.md +379 -0
- package/src/index.css +14 -0
- package/src/index.orig.css +13 -0
- package/src/lib/academic-sources.base.ts +188 -0
- package/src/lib/academic-sources.orig.ts +28 -0
- package/src/lib/academic-sources.ts +10 -0
- package/src/lib/advanced-math.ts +119 -0
- package/src/lib/adversarial-engine.base.ts +409 -0
- package/src/lib/adversarial-engine.ts +82 -0
- package/src/lib/ai-revision.ts +623 -0
- package/src/lib/app-state.tsx +426 -0
- package/src/lib/artifact-registry.ts +97 -0
- package/src/lib/artifacts.ts +180 -0
- package/src/lib/atlas-dr.ts +167 -0
- package/src/lib/browser-mtls.ts +127 -0
- package/src/lib/browser-queue.ts +221 -0
- package/src/lib/browser-search-scraper.base.ts +382 -0
- package/src/lib/browser-search-scraper.orig.ts +90 -0
- package/src/lib/browser-search-scraper.ts +10 -0
- package/src/lib/calc-interceptor.ts +82 -0
- package/src/lib/citation-lane-tap.ts +78 -0
- package/src/lib/citation-ledger-store.ts +369 -0
- package/src/lib/citation-ledger.ts +203 -0
- package/src/lib/compute-sandbox.ts +215 -0
- package/src/lib/compute.worker.ts +153 -0
- package/src/lib/connectors/gemini.ts +120 -0
- package/src/lib/connectors/jina.ts +233 -0
- package/src/lib/connectors/marketdata.ts +51 -0
- package/src/lib/connectors/prismafetch.base.ts +175 -0
- package/src/lib/connectors/prismafetch.ts +1 -0
- package/src/lib/connectors/serpapi.ts +65 -0
- package/src/lib/connectors/wikidata.ts +44 -0
- package/src/lib/constraints.ts +331 -0
- package/src/lib/continuation-detector.base.ts +153 -0
- package/src/lib/continuation-detector.ts +48 -0
- package/src/lib/contradraft.ts +168 -0
- package/src/lib/cors-proxy.ts +120 -0
- package/src/lib/coverage.ts +81 -0
- package/src/lib/debug/architecture-prescription.ts +556 -0
- package/src/lib/debug/covea-repair.ts +543 -0
- package/src/lib/debug/helios-ground.ts +319 -0
- package/src/lib/debug/intent-decomposer.ts +281 -0
- package/src/lib/debug/intent-lattice.ts +349 -0
- package/src/lib/debug/pipeline-diagnosis.ts +1149 -0
- package/src/lib/debug/pipeline-trace-bus.ts +424 -0
- package/src/lib/debug/prompt-forge.ts +678 -0
- package/src/lib/debug/repair-sites.ts +513 -0
- package/src/lib/debug/research-phase.ts +266 -0
- package/src/lib/debug/retrieval-context.ts +76 -0
- package/src/lib/debug/retrieval-hardener.ts +142 -0
- package/src/lib/debug/scraper-debug-runner.ts +576 -0
- package/src/lib/debug/scraper-forensics.ts +418 -0
- package/src/lib/debug/scraper-lane-roadmap.ts +136 -0
- package/src/lib/debug/self-test.ts +415 -0
- package/src/lib/debug/step-attribution.ts +211 -0
- package/src/lib/debug/template-rubric.ts +301 -0
- package/src/lib/debug/unified-innovation.ts +126 -0
- package/src/lib/debug/veritas-hybrid-scraper.ts +335 -0
- package/src/lib/defense-registry.ts +104 -0
- package/src/lib/defenses.ts +162 -0
- package/src/lib/deterministic-citation-ledger.ts +174 -0
- package/src/lib/elo-registry.base.ts +117 -0
- package/src/lib/elo-registry.ts +1 -0
- package/src/lib/entity-resolver.ts +291 -0
- package/src/lib/failure-modes.ts +267 -0
- package/src/lib/feature-registry.ts +69 -0
- package/src/lib/flaw-registry.ts +143 -0
- package/src/lib/flaws/_template.ts +52 -0
- package/src/lib/flaws/builtins.ts +63 -0
- package/src/lib/flaws/finance.ts +169 -0
- package/src/lib/flaws/fixers.ts +10 -0
- package/src/lib/flaws/index.ts +32 -0
- package/src/lib/flaws/legal.ts +157 -0
- package/src/lib/flaws/medical.ts +188 -0
- package/src/lib/flaws/original-defenses-pack.ts +81 -0
- package/src/lib/flaws/sample-declarative-pack.json +38 -0
- package/src/lib/flaws/selftest.ts +201 -0
- package/src/lib/flaws/software-extended.ts +125 -0
- package/src/lib/flaws/software-rn-webgl.ts +182 -0
- package/src/lib/flaws/statistics-advanced.ts +46 -0
- package/src/lib/flaws/statistics.ts +61 -0
- package/src/lib/gbse/config.ts +20 -0
- package/src/lib/gbse/engine.ts +226 -0
- package/src/lib/gbse/graph.ts +118 -0
- package/src/lib/gbse/graph.worker.ts +21 -0
- package/src/lib/gbse/tests.ts +117 -0
- package/src/lib/gbse/tiers.ts +65 -0
- package/src/lib/gbse/types.ts +94 -0
- package/src/lib/innovation-genome-engine-v2.orig.ts +1001 -0
- package/src/lib/innovation-genome-engine-v2.ts +3 -0
- package/src/lib/innovation-genome-engine.orig.ts +330 -0
- package/src/lib/innovation-genome-engine.ts +3 -0
- package/src/lib/innovation-genome-v10.orig.ts +314 -0
- package/src/lib/innovation-genome-v10.ts +2 -0
- package/src/lib/innovation-genome-v3.orig.ts +2015 -0
- package/src/lib/innovation-genome-v3.ts +2 -0
- package/src/lib/innovation-genome-v4.orig.ts +1959 -0
- package/src/lib/innovation-genome-v4.ts +2 -0
- package/src/lib/innovation-genome-v5.orig.ts +1210 -0
- package/src/lib/innovation-genome-v5.ts +2 -0
- package/src/lib/innovation-genome-v7.orig.ts +2549 -0
- package/src/lib/innovation-genome-v7.ts +2 -0
- package/src/lib/innovation-genome-v8.orig.ts +1485 -0
- package/src/lib/innovation-genome-v8.ts +2 -0
- package/src/lib/innovation-genome-v9.orig.ts +643 -0
- package/src/lib/innovation-genome-v9.ts +2 -0
- package/src/lib/jina.base.ts +293 -0
- package/src/lib/jina.ts +1 -0
- package/src/lib/live-telemetry.ts +61 -0
- package/src/lib/longwriter.ts +84 -0
- package/src/lib/manuscript-grade-v2.ts +298 -0
- package/src/lib/memory-governor.ts +173 -0
- package/src/lib/memory-stress-tests.ts +248 -0
- package/src/lib/model-intelligence.ts +48 -0
- package/src/lib/model-rotator.ts +75 -0
- package/src/lib/models.orig.ts +513 -0
- package/src/lib/models.ts +151 -0
- package/src/lib/n-deep.base.ts +592 -0
- package/src/lib/n-deep.ts +51 -0
- package/src/lib/nih-simulator.ts +56 -0
- package/src/lib/nih-vulnerability-fixes.ts +460 -0
- package/src/lib/omega-templates.base.ts +294 -0
- package/src/lib/omega-templates.ts +225 -0
- package/src/lib/omni-nexus.ts +64 -0
- package/src/lib/oracle-adapters.ts +67 -0
- package/src/lib/oracle-registry.ts +163 -0
- package/src/lib/orchestrator.ts +357 -0
- package/src/lib/output-boundary.ts +235 -0
- package/src/lib/overrides/vite-native-chaos-harness.ts +154 -0
- package/src/lib/overrides/vite-native-contract-plane.ts +245 -0
- package/src/lib/overrides/vite-native-doctor-plane.ts +208 -0
- package/src/lib/overrides/vite-native-knowledge-store.ts +267 -0
- package/src/lib/overrides/vite-native-policy-plane.ts +190 -0
- package/src/lib/overrides/vite-native-replay-plane.ts +197 -0
- package/src/lib/overrides/vite-native-runtime-plane.ts +106 -0
- package/src/lib/overrides/vite-native-scraper.ts +848 -0
- package/src/lib/overrides/vite-native-selftest-functional.ts +217 -0
- package/src/lib/overrides/vite-native-selftest.ts +183 -0
- package/src/lib/overrides/vite-native-snapshot-plane.ts +123 -0
- package/src/lib/philosophy-toolkit.ts +75 -0
- package/src/lib/pipeline.orig.ts +659 -0
- package/src/lib/pipeline.ts +42 -0
- package/src/lib/precache.ts +128 -0
- package/src/lib/py-sandbox.ts +205 -0
- package/src/lib/quality-score.ts +96 -0
- package/src/lib/quant-engine.ts +231 -0
- package/src/lib/quant-lib.ts +80 -0
- package/src/lib/reportos.ts +175 -0
- package/src/lib/research-os.ts +306 -0
- package/src/lib/resource-estimator.ts +114 -0
- package/src/lib/rpm-governor.ts +93 -0
- package/src/lib/runtime-estimator.ts +135 -0
- package/src/lib/sage/empty-space-v6.ts +560 -0
- package/src/lib/sage/empty-space-v7.ts +222 -0
- package/src/lib/sage/empty-space.ts +733 -0
- package/src/lib/sage/engine.ts +786 -0
- package/src/lib/sage/index.ts +17 -0
- package/src/lib/sage/judge.ts +246 -0
- package/src/lib/sage/prng.ts +53 -0
- package/src/lib/sage/reality-grounding.ts +380 -0
- package/src/lib/sage/repetition.ts +151 -0
- package/src/lib/sage/saga-os-v2-engines.ts +1870 -0
- package/src/lib/sage/saga-os-v2.ts +274 -0
- package/src/lib/sage/saga-os-v3-core.ts +1491 -0
- package/src/lib/sage/saga-os-v3-release.ts +739 -0
- package/src/lib/sage/saga-os-v4-aureate.ts +1161 -0
- package/src/lib/sage/saga-os-v4.ts +212 -0
- package/src/lib/sage/saga-os-v5.ts +205 -0
- package/src/lib/sage/saga-os-v6.ts +346 -0
- package/src/lib/sage/saga-os-v7.ts +314 -0
- package/src/lib/sage/saga-os-v8.ts +505 -0
- package/src/lib/sage/saga-os.ts +329 -0
- package/src/lib/sage/taxonomy.ts +403 -0
- package/src/lib/sage/unified-roll.ts +524 -0
- package/src/lib/sage/worked-sketches.ts +44 -0
- package/src/lib/sage.ts +166 -0
- package/src/lib/scraper-debug-bus.ts +53 -0
- package/src/lib/scraper-enhanced.orig.ts +153 -0
- package/src/lib/scraper-enhanced.ts +10 -0
- package/src/lib/scraper-hardener.base.orig.ts +155 -0
- package/src/lib/scraper-hardener.base.ts +317 -0
- package/src/lib/scraper-hardener.ts +1 -0
- package/src/lib/scraper-palisade/palisade-adjudicator.orig.ts +419 -0
- package/src/lib/scraper-palisade/palisade-adjudicator.ts +13 -0
- package/src/lib/scraper-vnext/arbiter-omega.orig.ts +688 -0
- package/src/lib/scraper-vnext/arbiter-omega.ts +13 -0
- package/src/lib/scraper-vnext/canonical-portfolio-augments.ts +479 -0
- package/src/lib/scraper-vnext/canonical-portfolio-orchestrator.orig.ts +1529 -0
- package/src/lib/scraper-vnext/canonical-portfolio-orchestrator.ts +13 -0
- package/src/lib/scraper-vnext/conclave-omega.ts +1830 -0
- package/src/lib/scraper-vnext/content-extractor-v2.ts +226 -0
- package/src/lib/scraper-vnext/diagnostics-suite.ts +36 -0
- package/src/lib/scraper-vnext/epistemic-packer.ts +97 -0
- package/src/lib/scraper-vnext/fusion-v2.ts +65 -0
- package/src/lib/scraper-vnext/hydra-reader.orig.ts +1216 -0
- package/src/lib/scraper-vnext/hydra-reader.ts +13 -0
- package/src/lib/scraper-vnext/native-scraper-browser-vnext.orig.ts +91 -0
- package/src/lib/scraper-vnext/native-scraper-browser-vnext.ts +13 -0
- package/src/lib/scraper-vnext/nexus-consensus.orig.ts +905 -0
- package/src/lib/scraper-vnext/nexus-consensus.ts +13 -0
- package/src/lib/scraper-vnext/portfolio-consensus-adjudicator.ts +804 -0
- package/src/lib/scraper-vnext/portfolio-consensus-memory.ts +377 -0
- package/src/lib/scraper-vnext/portfolio-terminal-governor.ts +548 -0
- package/src/lib/scraper-vnext/query-strategist.orig.ts +224 -0
- package/src/lib/scraper-vnext/query-strategist.ts +423 -0
- package/src/lib/scraper-vnext/retrieval-accelerator.ts +708 -0
- package/src/lib/scraper-vnext/retrieval-audit-augments.ts +477 -0
- package/src/lib/scraper-vnext/retrieval-control-plane.ts +904 -0
- package/src/lib/scraper-vnext/retrieval-policy-augments.ts +358 -0
- package/src/lib/scraper-vnext/safe-fetch-v2.ts +157 -0
- package/src/lib/scraper-vnext/sentinel-omega.ts +56 -0
- package/src/lib/scraper-vnext/sentinel-orchestrator.ts +69 -0
- package/src/lib/scraper-vnext/sibyl-oracle.orig.ts +413 -0
- package/src/lib/scraper-vnext/sibyl-oracle.ts +13 -0
- package/src/lib/scraper-vnext/smart-read-v2.ts +55 -0
- package/src/lib/scraper-vnext/spa-rescue-bridge.ts +608 -0
- package/src/lib/scraper-vnext/strata-engine.orig.ts +2666 -0
- package/src/lib/scraper-vnext/strata-engine.ts +13 -0
- package/src/lib/scraper-vnext/structured-source-adapter.orig.ts +369 -0
- package/src/lib/scraper-vnext/structured-source-adapter.ts +34 -0
- package/src/lib/scraper-vnext/terminal-complete.ts +224 -0
- package/src/lib/scraper-vnext/terminal-final.ts +277 -0
- package/src/lib/scraper-vnext/terminal-saturation.ts +345 -0
- package/src/lib/scraper-vnext/terminal-wire.ts +425 -0
- package/src/lib/scraper-vnext/vanguard-titanium.orig.ts +467 -0
- package/src/lib/scraper-vnext/vanguard-titanium.ts +17 -0
- package/src/lib/search-cache.ts +138 -0
- package/src/lib/sloop-runner.base.ts +223 -0
- package/src/lib/sloop-runner.ts +104 -0
- package/src/lib/sloop.ts +114 -0
- package/src/lib/small-model-adapters.ts +82 -0
- package/src/lib/sscp.ts +86 -0
- package/src/lib/system-map.ts +54 -0
- package/src/lib/uni-node.ts +86 -0
- package/src/lib/universal-rigor-guard.ts +433 -0
- package/src/lib/v15-gate-testbed.ts +274 -0
- package/src/lib/v15-gemini.base.ts +89 -0
- package/src/lib/v15-gemini.ts +1 -0
- package/src/lib/v15-grounding.orig.ts +241 -0
- package/src/lib/v15-grounding.ts +79 -0
- package/src/lib/v15-pipeline.base.ts +769 -0
- package/src/lib/v15-pipeline.orig.ts +1154 -0
- package/src/lib/v15-pipeline.ts +674 -0
- package/src/lib/v15-questions.ts +64 -0
- package/src/lib/v15-rate-limiter.orig.ts +91 -0
- package/src/lib/v15-rate-limiter.ts +48 -0
- package/src/lib/v15-state.base.ts +87 -0
- package/src/lib/v15-state.ts +28 -0
- package/src/lib/visual-table-generator.tsx +207 -0
- package/src/lib/wasm-runtime.ts +133 -0
- package/src/lib/williams-persona-guide.ts +265 -0
- package/src/lib/williams-style.base.ts +464 -0
- package/src/lib/williams-style.ts +59 -0
- package/src/lib/worker-pool.ts +96 -0
- package/src/lib/writing-tiers.ts +125 -0
- package/src/main.orig.tsx +10 -0
- package/src/main.tsx +10 -0
- package/src/utils/cn.orig.ts +6 -0
- package/src/utils/cn.ts +6 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.json +31 -0
- package/unify.mjs +537 -0
- package/vite.config.ts +18 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { useMemo, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
CreativeStudio,
|
|
4
|
+
V10CreativeStore,
|
|
5
|
+
buildV10DiscoveryContext,
|
|
6
|
+
type CreativeBrief,
|
|
7
|
+
type CreativeMode,
|
|
8
|
+
type IdeaCard,
|
|
9
|
+
} from "@/lib/innovation-genome-v10";
|
|
10
|
+
|
|
11
|
+
const MODES: CreativeMode[] = ["idea", "theory", "product", "code", "research", "story"];
|
|
12
|
+
const stageColor: Record<string, string> = {
|
|
13
|
+
seed: "bg-amber-700", sprout: "bg-lime-400", branch: "bg-emerald-500",
|
|
14
|
+
bloom: "bg-pink-400", fruit: "bg-amber-400", compost: "bg-stone-500",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function CreativeTreeOfLifePanel() {
|
|
18
|
+
const [expanded, setExpanded] = useState(false);
|
|
19
|
+
const [challenge, setChallenge] = useState("Find a high-value opportunity hidden by current assumptions");
|
|
20
|
+
const [mode, setMode] = useState<CreativeMode>("research");
|
|
21
|
+
const [seed, setSeed] = useState(42);
|
|
22
|
+
const [studio, setStudio] = useState<CreativeStudio | null>(null);
|
|
23
|
+
const [workspaceId, setWorkspaceId] = useState("");
|
|
24
|
+
const [version, setVersion] = useState(0);
|
|
25
|
+
const [selected, setSelected] = useState<string[]>([]);
|
|
26
|
+
const [directive, setDirective] = useState<ReturnType<typeof buildV10DiscoveryContext> | null>(null);
|
|
27
|
+
|
|
28
|
+
const nodes = useMemo(() => studio && workspaceId ? studio.workspaceNodes(workspaceId) : [], [studio, workspaceId, version]);
|
|
29
|
+
const ranking = useMemo(() => studio && workspaceId ? studio.rankIdeas(workspaceId) : [], [studio, workspaceId, version]);
|
|
30
|
+
const health = useMemo(() => studio && workspaceId ? studio.treeHealth(workspaceId) : null, [studio, workspaceId, version]);
|
|
31
|
+
|
|
32
|
+
const grow = () => {
|
|
33
|
+
const next = new CreativeStudio(new V10CreativeStore());
|
|
34
|
+
const profile = next.bootstrapLocal("Creator");
|
|
35
|
+
const brief: CreativeBrief = {
|
|
36
|
+
challenge, mode,
|
|
37
|
+
audience: ["person most affected by challenge"],
|
|
38
|
+
desiredOutcomes: ["useful, testable progress"],
|
|
39
|
+
constraints: ["preserve uncertainty; do not invent facts"],
|
|
40
|
+
resources: ["existing knowledge, evidence, relationships, tools"],
|
|
41
|
+
inspirationDomains: ["ecology", "distributed systems", "craft", "scientific instrumentation"],
|
|
42
|
+
avoid: ["generic repetition", "unsupported global novelty claims"],
|
|
43
|
+
axes: { evidence: ["primary sources", "counter-evidence", "implementation evidence"] },
|
|
44
|
+
};
|
|
45
|
+
const ws = next.createWorkspace(profile, challenge.slice(0, 64), brief, seed);
|
|
46
|
+
next.creativeExplosion(ws, 8, 16);
|
|
47
|
+
const context = buildV10DiscoveryContext(challenge, mode, seed);
|
|
48
|
+
setStudio(next); setWorkspaceId(ws); setDirective(context); setSelected([]); setVersion(v => v + 1);
|
|
49
|
+
try {
|
|
50
|
+
localStorage.setItem("veritas.v10.discoveryDirective", context.directive);
|
|
51
|
+
localStorage.setItem("veritas.v10.searchAngles", JSON.stringify(context.searchAngles));
|
|
52
|
+
} catch { /* storage optional */ }
|
|
53
|
+
window.dispatchEvent(new CustomEvent("veritas:v10-discovery", { detail: context }));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const confirm = (nodeId: string, verdict: "confirm" | "reject") => {
|
|
57
|
+
if (!studio) return;
|
|
58
|
+
studio.confirm(nodeId, "overall", verdict, 5, verdict === "confirm" ? "Human-selected branch" : "Human-rejected branch; preserve as compost");
|
|
59
|
+
setVersion(v => v + 1);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const cross = () => {
|
|
63
|
+
if (!studio || selected.length !== 2) return;
|
|
64
|
+
studio.crossPollinate(selected[0], selected[1]);
|
|
65
|
+
setSelected([]); setVersion(v => v + 1);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const toggle = (id: string) => setSelected(s => s.includes(id) ? s.filter(x => x !== id) : s.length < 2 ? [...s, id] : [s[1], id]);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<section className="rounded-2xl border border-lime-200 bg-white shadow-sm">
|
|
72
|
+
<button onClick={() => setExpanded(!expanded)} className="flex w-full items-center justify-between px-5 py-3 text-left">
|
|
73
|
+
<div className="flex items-center gap-3">
|
|
74
|
+
<div className="grid h-8 w-8 place-items-center rounded-lg bg-gradient-to-br from-lime-100 to-emerald-100 text-lg">🌳</div>
|
|
75
|
+
<div>
|
|
76
|
+
<div className="text-sm font-bold text-zinc-900">Creative Tree of Life <span className="text-lime-700">V10</span></div>
|
|
77
|
+
<div className="text-xs text-zinc-500">Offline discovery studio · unverified branches · human-governed selection</div>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
<div className="flex items-center gap-2">
|
|
81
|
+
{health && <span className="rounded bg-lime-50 px-2 py-1 font-mono text-[10px] text-lime-800">{health.nodeCount} nodes</span>}
|
|
82
|
+
<span className="text-zinc-400">{expanded ? "−" : "+"}</span>
|
|
83
|
+
</div>
|
|
84
|
+
</button>
|
|
85
|
+
|
|
86
|
+
{expanded && (
|
|
87
|
+
<div className="border-t border-zinc-100 px-5 py-4">
|
|
88
|
+
<div className="grid gap-2 md:grid-cols-[1fr_auto_auto_auto]">
|
|
89
|
+
<input value={challenge} onChange={e => setChallenge(e.target.value)} className="rounded-lg border border-zinc-300 px-3 py-2 text-xs" aria-label="Creative challenge" />
|
|
90
|
+
<select value={mode} onChange={e => setMode(e.target.value as CreativeMode)} className="rounded-lg border border-zinc-300 bg-white px-2 py-2 text-xs">
|
|
91
|
+
{MODES.map(m => <option key={m}>{m}</option>)}
|
|
92
|
+
</select>
|
|
93
|
+
<input type="number" value={seed} onChange={e => setSeed(Number(e.target.value) >>> 0)} className="w-28 rounded-lg border border-zinc-300 px-2 py-2 font-mono text-xs" aria-label="Creative seed" />
|
|
94
|
+
<button onClick={grow} className="rounded-lg bg-lime-700 px-4 py-2 text-xs font-bold text-white hover:bg-lime-800">Grow tree</button>
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
{health && (
|
|
98
|
+
<div className="mt-3 grid grid-cols-3 gap-2 md:grid-cols-6">
|
|
99
|
+
{[["nodes",health.nodeCount],["branches",health.branchCount],["families",health.operatorFamilyCount],["novelty",health.meanLocalNovelty.toFixed(2)],["cohesion",health.meanCohesion.toFixed(2)],["human touch",`${Math.round(health.humanTouchRate*100)}%`]].map(([k,v]) => (
|
|
100
|
+
<div key={String(k)} className="rounded-lg border border-zinc-100 bg-zinc-50 p-2 text-center"><div className="text-[9px] uppercase text-zinc-400">{k}</div><div className="font-mono text-xs font-bold text-zinc-800">{v}</div></div>
|
|
101
|
+
))}
|
|
102
|
+
</div>
|
|
103
|
+
)}
|
|
104
|
+
|
|
105
|
+
{nodes.length > 0 && (
|
|
106
|
+
<div className="mt-4 grid gap-4 lg:grid-cols-[minmax(260px,0.8fr)_1.2fr]">
|
|
107
|
+
<div className="rounded-xl border border-zinc-200 bg-zinc-950 p-3 text-zinc-100">
|
|
108
|
+
<div className="mb-2 flex items-center justify-between text-[10px] font-bold uppercase tracking-wider text-lime-300"><span>Tree paths</span><span>{selected.length}/2 selected</span></div>
|
|
109
|
+
<div className="max-h-[430px] space-y-1 overflow-y-auto">
|
|
110
|
+
{nodes.map(n => (
|
|
111
|
+
<button key={n.nodeId} onClick={() => (n.nodeKind === "idea" || n.nodeKind === "synthesis") && toggle(n.nodeId)} className={`flex w-full items-center gap-2 rounded px-2 py-1 text-left text-[10px] ${selected.includes(n.nodeId) ? "bg-lime-900 ring-1 ring-lime-400" : "hover:bg-zinc-900"}`} style={{ paddingLeft: `${8 + n.depth * 14}px` }}>
|
|
112
|
+
<span className={`h-2 w-2 shrink-0 rounded-full ${stageColor[n.lifeStage]}`} />
|
|
113
|
+
<span className="truncate">{n.title}</span><span className="ml-auto text-[8px] text-zinc-500">{n.lifeStage}</span>
|
|
114
|
+
</button>
|
|
115
|
+
))}
|
|
116
|
+
</div>
|
|
117
|
+
<button onClick={cross} disabled={selected.length !== 2} className="mt-3 w-full rounded bg-fuchsia-700 px-2 py-1.5 text-[10px] font-bold text-white disabled:opacity-30">Cross-pollinate selected branches</button>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
<div className="max-h-[520px] space-y-2 overflow-y-auto pr-1">
|
|
121
|
+
{ranking.slice(0, 12).map((item, index) => {
|
|
122
|
+
const card = item.node.body as IdeaCard;
|
|
123
|
+
return (
|
|
124
|
+
<article key={item.node.nodeId} className={`rounded-xl border p-3 ${item.node.status === "rejected" ? "border-stone-300 bg-stone-50 opacity-70" : item.node.status === "favorite" ? "border-lime-400 bg-lime-50" : "border-zinc-200 bg-white"}`}>
|
|
125
|
+
<div className="flex items-start justify-between gap-2"><div><span className="mr-2 text-[9px] font-bold text-zinc-400">#{index+1}</span><span className="text-xs font-bold text-zinc-900">{card.title}</span></div><span className="rounded bg-zinc-100 px-1.5 py-0.5 font-mono text-[9px]">{item.score.toFixed(2)}</span></div>
|
|
126
|
+
<p className="mt-1 text-[10px] leading-relaxed text-zinc-600">{card.thesis}</p>
|
|
127
|
+
<div className="mt-2 rounded bg-zinc-50 p-2 text-[9px] text-zinc-600"><b>Mechanism:</b> {card.mechanism}</div>
|
|
128
|
+
<div className="mt-2 flex flex-wrap gap-1 text-[8px] text-zinc-500"><span>novelty {item.noveltyScore.toFixed(2)}</span><span>· cohesion {item.cohesionScore.toFixed(2)}</span><span>· {card.operatorFamily}</span><span>· {card.epistemicStatus}</span></div>
|
|
129
|
+
<div className="mt-2 flex gap-1"><button onClick={() => confirm(item.node.nodeId,"confirm")} className="rounded bg-lime-600 px-2 py-1 text-[9px] font-bold text-white">Confirm</button><button onClick={() => confirm(item.node.nodeId,"reject")} className="rounded bg-stone-600 px-2 py-1 text-[9px] font-bold text-white">Compost</button><button onClick={() => toggle(item.node.nodeId)} className="rounded border border-zinc-200 px-2 py-1 text-[9px]">Select</button></div>
|
|
130
|
+
</article>
|
|
131
|
+
);
|
|
132
|
+
})}
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
)}
|
|
136
|
+
|
|
137
|
+
{directive && (
|
|
138
|
+
<div className="mt-4 grid gap-3 md:grid-cols-2">
|
|
139
|
+
<div className="rounded-xl border border-sky-200 bg-sky-50 p-3"><div className="text-[10px] font-bold uppercase text-sky-800">Scraper search angles</div><ol className="mt-2 list-decimal space-y-1 pl-4 text-[10px] text-sky-900">{directive.searchAngles.map((a,i)=><li key={i}>{a}</li>)}</ol></div>
|
|
140
|
+
<div className="rounded-xl border border-amber-200 bg-amber-50 p-3"><div className="text-[10px] font-bold uppercase text-amber-800">Next logic moves</div><ol className="mt-2 list-decimal space-y-1 pl-4 text-[10px] text-amber-900">{directive.nextMoves.map((a,i)=><li key={i}>{a}</li>)}</ol></div>
|
|
141
|
+
<details className="md:col-span-2"><summary className="cursor-pointer text-xs font-bold text-zinc-600">Pipeline discovery directive</summary><pre className="mt-2 max-h-64 overflow-auto whitespace-pre-wrap rounded-xl bg-zinc-950 p-3 text-[9px] text-lime-300">{directive.directive}</pre></details>
|
|
142
|
+
<div className="md:col-span-2 flex gap-2"><button onClick={() => navigator.clipboard.writeText(directive.directive)} className="rounded-lg border border-zinc-200 px-3 py-1.5 text-xs font-bold">Copy directive</button><button onClick={() => studio && navigator.clipboard.writeText(studio.exportJson(workspaceId))} className="rounded-lg border border-zinc-200 px-3 py-1.5 text-xs font-bold">Export JSON</button><button onClick={() => studio && navigator.clipboard.writeText(studio.exportTerminal(workspaceId))} className="rounded-lg border border-zinc-200 px-3 py-1.5 text-xs font-bold">Export tree</button></div>
|
|
143
|
+
</div>
|
|
144
|
+
)}
|
|
145
|
+
</div>
|
|
146
|
+
)}
|
|
147
|
+
</section>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debug/Reasoning Trace Panel
|
|
3
|
+
* Shows detailed pipeline execution trace for debugging.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { useMemo } from "react";
|
|
7
|
+
import type { PipelineTrace } from "../lib/pipeline";
|
|
8
|
+
import { getCacheStats } from "../lib/precache";
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
trace: PipelineTrace[];
|
|
12
|
+
telemetry?: {
|
|
13
|
+
tokensIn: number;
|
|
14
|
+
tokensOut: number;
|
|
15
|
+
toolCalls: number;
|
|
16
|
+
hypotheses: number;
|
|
17
|
+
sources: number;
|
|
18
|
+
claimsTotal: number;
|
|
19
|
+
claimsVerified: number;
|
|
20
|
+
elapsedMs: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function DebugTracePanel({ trace, telemetry }: Props) {
|
|
25
|
+
const cacheStats = useMemo(() => getCacheStats(), []);
|
|
26
|
+
|
|
27
|
+
const phaseIcons: Record<string, string> = {
|
|
28
|
+
"1": "🎯",
|
|
29
|
+
"1.5": "📦",
|
|
30
|
+
"2": "🧠",
|
|
31
|
+
"2.5": "🔢",
|
|
32
|
+
"3": "✍️",
|
|
33
|
+
"4": "🧹",
|
|
34
|
+
"5": "🔒",
|
|
35
|
+
"6": "📜",
|
|
36
|
+
"7": "🔐",
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const phaseColors: Record<string, string> = {
|
|
40
|
+
"1": "text-indigo-600",
|
|
41
|
+
"1.5": "text-sky-600",
|
|
42
|
+
"2": "text-indigo-700",
|
|
43
|
+
"2.5": "text-violet-700",
|
|
44
|
+
"3": "text-emerald-700",
|
|
45
|
+
"4": "text-amber-700",
|
|
46
|
+
"5": "text-indigo-800",
|
|
47
|
+
"6": "text-violet-800",
|
|
48
|
+
"7": "text-emerald-800",
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div className="rounded-2xl border border-zinc-200 bg-white shadow-sm overflow-hidden">
|
|
53
|
+
<div className="border-b border-zinc-200 px-4 py-2.5 flex items-center justify-between">
|
|
54
|
+
<div className="flex items-center gap-2">
|
|
55
|
+
<span className="text-sm font-bold text-zinc-900">Debug / Reasoning Trace</span>
|
|
56
|
+
<span className="text-xs font-mono text-zinc-500">{trace.length} steps</span>
|
|
57
|
+
</div>
|
|
58
|
+
<div className="text-xs font-mono text-zinc-500">
|
|
59
|
+
Cache: {Object.entries(cacheStats).map(([k, v]) => `${k}:${v.size}/${v.totalHits}`).join(" ")}
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<div className="p-4">
|
|
64
|
+
{/* Pipeline Progress */}
|
|
65
|
+
<div className="mb-4">
|
|
66
|
+
<div className="text-[10px] font-bold uppercase tracking-wider text-zinc-400 mb-2">Pipeline Execution Trace</div>
|
|
67
|
+
<div className="flex items-center gap-1">
|
|
68
|
+
{Array.from({ length: 7 }).map((_, i) => {
|
|
69
|
+
const stageNum = (i + 1).toString();
|
|
70
|
+
const stageTrace = trace.find(t => t.stage.toString().startsWith(stageNum));
|
|
71
|
+
return (
|
|
72
|
+
<div key={i} className="flex-1">
|
|
73
|
+
<div className={`h-2 rounded-full ${stageTrace ? "bg-emerald-500" : "bg-zinc-200"}`} />
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
})}
|
|
77
|
+
</div>
|
|
78
|
+
<div className="flex justify-between text-[9px] text-zinc-400 mt-1">
|
|
79
|
+
<span>Stage 1</span>
|
|
80
|
+
<span>Stage 7</span>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
{/* Detailed Trace */}
|
|
85
|
+
<div className="space-y-2">
|
|
86
|
+
{trace.length === 0 ? (
|
|
87
|
+
<div className="text-center text-zinc-400 py-8">
|
|
88
|
+
No trace available. Run a query to see pipeline execution.
|
|
89
|
+
</div>
|
|
90
|
+
) : (
|
|
91
|
+
trace.map((t, i) => (
|
|
92
|
+
<div
|
|
93
|
+
key={i}
|
|
94
|
+
className={`rounded-lg border p-3 ${t.ok ? "border-emerald-200 bg-emerald-50/30" : "border-rose-200 bg-rose-50/30"}`}
|
|
95
|
+
>
|
|
96
|
+
<div className="flex items-center gap-2 mb-1">
|
|
97
|
+
<span className="text-lg">{phaseIcons[t.stage.toString()] || "•"}</span>
|
|
98
|
+
<span className={`text-xs font-bold ${phaseColors[t.stage.toString()] || "text-zinc-600"}`}>
|
|
99
|
+
Stage {t.stage}
|
|
100
|
+
</span>
|
|
101
|
+
<span className={`text-xs font-mono ${t.ok ? "text-emerald-600" : "text-rose-600"}`}>
|
|
102
|
+
{t.ok ? "✓" : "✗"}
|
|
103
|
+
</span>
|
|
104
|
+
<span className="text-[10px] text-zinc-400 ml-auto">
|
|
105
|
+
{new Date(t.ts).toLocaleTimeString()}
|
|
106
|
+
</span>
|
|
107
|
+
</div>
|
|
108
|
+
<div className="text-sm text-zinc-800">{t.label}</div>
|
|
109
|
+
{(() => {
|
|
110
|
+
if (!t.data) return null;
|
|
111
|
+
const content = typeof t.data === "string" ? t.data : JSON.stringify(t.data);
|
|
112
|
+
return <pre className="mt-1 text-[10px] font-mono text-zinc-500 overflow-x-auto whitespace-pre-wrap">{content.slice(0, 200)}</pre>;
|
|
113
|
+
})()}
|
|
114
|
+
</div>
|
|
115
|
+
))
|
|
116
|
+
)}
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
{/* Telemetry Summary */}
|
|
120
|
+
{telemetry && (
|
|
121
|
+
<div className="mt-4 rounded-xl border border-zinc-200 bg-zinc-50 p-3">
|
|
122
|
+
<div className="text-[10px] font-bold uppercase tracking-wider text-zinc-400 mb-2">Telemetry Summary</div>
|
|
123
|
+
<div className="grid grid-cols-3 gap-2 text-xs">
|
|
124
|
+
<div><span className="text-zinc-500">Tokens In:</span> <span className="font-mono font-bold">{telemetry.tokensIn.toLocaleString()}</span></div>
|
|
125
|
+
<div><span className="text-zinc-500">Tokens Out:</span> <span className="font-mono font-bold">{telemetry.tokensOut.toLocaleString()}</span></div>
|
|
126
|
+
<div><span className="text-zinc-500">Tool Calls:</span> <span className="font-mono font-bold">{telemetry.toolCalls}</span></div>
|
|
127
|
+
<div><span className="text-zinc-500">Hypotheses:</span> <span className="font-mono font-bold">{telemetry.hypotheses}</span></div>
|
|
128
|
+
<div><span className="text-zinc-500">Sources:</span> <span className="font-mono font-bold">{telemetry.sources}</span></div>
|
|
129
|
+
<div><span className="text-zinc-500">Claims:</span> <span className="font-mono font-bold">{telemetry.claimsVerified}/{telemetry.claimsTotal}</span></div>
|
|
130
|
+
<div><span className="text-zinc-500">Elapsed:</span> <span className="font-mono font-bold">{(telemetry.elapsedMs / 1000).toFixed(1)}s</span></div>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
)}
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useAppState } from "../lib/app-state";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Deep Reasoning Trace — Hierarchical ledger of the cognitive process.
|
|
5
|
+
* Surfaced in the advanced workspace to debug silent pipeline failures.
|
|
6
|
+
*/
|
|
7
|
+
export function DeepReasoningTrace() {
|
|
8
|
+
const { reasoningTrace } = useAppState();
|
|
9
|
+
|
|
10
|
+
if (reasoningTrace.length === 0) {
|
|
11
|
+
return (
|
|
12
|
+
<div className="rounded-2xl border border-dashed border-zinc-200 bg-white p-12 text-center text-sm text-zinc-400">
|
|
13
|
+
No reasoning trace captured. Run a 4-stage pipeline to populate the cognitive ledger.
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div className="space-y-4">
|
|
20
|
+
<div className="flex items-center justify-between border-b border-zinc-100 pb-2">
|
|
21
|
+
<h3 className="text-sm font-bold text-zinc-900 uppercase tracking-widest">Cognitive Ledger — Reasoning Trace</h3>
|
|
22
|
+
<span className="font-mono text-[10px] text-zinc-400">{reasoningTrace.length} entries</span>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div className="space-y-2">
|
|
26
|
+
{reasoningTrace.map((entry, i) => (
|
|
27
|
+
<div key={i} className="rounded-xl border border-zinc-100 bg-white p-3 shadow-sm">
|
|
28
|
+
<div className="flex items-center gap-2 mb-1.5">
|
|
29
|
+
<span className="font-mono text-[10px] text-zinc-400">[{new Date(entry.ts).toLocaleTimeString()}]</span>
|
|
30
|
+
<span className={`px-1.5 py-0.5 rounded text-[10px] font-bold uppercase ${
|
|
31
|
+
entry.ok ? "bg-emerald-50 text-emerald-700" : "bg-rose-50 text-rose-700"
|
|
32
|
+
}`}>
|
|
33
|
+
{entry.phase || "trace"}
|
|
34
|
+
</span>
|
|
35
|
+
<span className="text-xs font-bold text-zinc-800">{entry.label}</span>
|
|
36
|
+
</div>
|
|
37
|
+
{entry.detail && <p className="text-xs text-zinc-600 leading-relaxed pl-1">{entry.detail}</p>}
|
|
38
|
+
{entry.data && (
|
|
39
|
+
<pre className="mt-2 overflow-auto rounded-lg bg-zinc-950 p-2 font-mono text-[10px] text-emerald-400 max-h-40">
|
|
40
|
+
{JSON.stringify(entry.data, null, 2)}
|
|
41
|
+
</pre>
|
|
42
|
+
)}
|
|
43
|
+
</div>
|
|
44
|
+
))}
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { EntitySheet } from "../lib/entity-resolver";
|
|
2
|
+
|
|
3
|
+
/** Compact inline display of the verified entity sheet attached to a chat answer. */
|
|
4
|
+
export function EntitySheetInline({ sheet }: { sheet: EntitySheet }) {
|
|
5
|
+
if (!sheet || sheet.entities.length === 0) return null;
|
|
6
|
+
return (
|
|
7
|
+
<details className="mb-3">
|
|
8
|
+
<summary className="cursor-pointer text-xs font-semibold text-sky-700 hover:text-sky-900">
|
|
9
|
+
Verified entity sheet ({sheet.entities.length} resolved, {sheet.weakEntities.length} weak)
|
|
10
|
+
</summary>
|
|
11
|
+
<div className="mt-2 rounded-xl border border-sky-100 bg-sky-50/60 overflow-hidden">
|
|
12
|
+
<table className="w-full text-[11px]">
|
|
13
|
+
<thead className="bg-sky-100/80">
|
|
14
|
+
<tr>
|
|
15
|
+
<th className="px-2 py-1.5 text-left font-bold text-sky-800">Ticker</th>
|
|
16
|
+
<th className="px-2 py-1.5 text-left font-bold text-sky-800">Company</th>
|
|
17
|
+
<th className="px-2 py-1.5 text-left font-bold text-sky-800">Facts</th>
|
|
18
|
+
<th className="px-2 py-1.5 text-left font-bold text-sky-800">Sources</th>
|
|
19
|
+
<th className="px-2 py-1.5 text-left font-bold text-sky-800">Catalyst</th>
|
|
20
|
+
</tr>
|
|
21
|
+
</thead>
|
|
22
|
+
<tbody className="divide-y divide-sky-100">
|
|
23
|
+
{sheet.entities.map((e) => (
|
|
24
|
+
<tr key={e.ticker} className="hover:bg-sky-50">
|
|
25
|
+
<td className="px-2 py-1.5 font-mono font-bold text-sky-900">{e.ticker}</td>
|
|
26
|
+
<td className="px-2 py-1.5 text-zinc-900">{e.name}</td>
|
|
27
|
+
<td className="px-2 py-1.5">
|
|
28
|
+
<div className="flex flex-wrap gap-1">
|
|
29
|
+
{Object.entries(e.facts).map(([k, v]) => (
|
|
30
|
+
<span key={k} className="inline-flex rounded bg-white px-1.5 py-0.5 text-[10px] font-mono text-zinc-700 shadow-sm">
|
|
31
|
+
{k}: <span className="ml-0.5 font-bold text-zinc-900">{v}</span>
|
|
32
|
+
</span>
|
|
33
|
+
))}
|
|
34
|
+
{Object.keys(e.facts).length === 0 && <span className="text-zinc-400 italic">no metrics found</span>}
|
|
35
|
+
</div>
|
|
36
|
+
</td>
|
|
37
|
+
<td className="px-2 py-1.5 font-mono text-[10px] text-zinc-500">{e.sourceIndices.map((i) => `S${i}`).join(", ")}</td>
|
|
38
|
+
<td className="px-2 py-1.5 text-[10px] text-zinc-600">{e.catalystRaw?.slice(0, 60) ?? "—"}</td>
|
|
39
|
+
</tr>
|
|
40
|
+
))}
|
|
41
|
+
</tbody>
|
|
42
|
+
</table>
|
|
43
|
+
{sheet.weakEntities.length > 0 && (
|
|
44
|
+
<div className="border-t border-sky-100 px-3 py-1.5 text-[10px] text-amber-800">
|
|
45
|
+
Weak / unresolved: {sheet.weakEntities.join(", ")} — insufficient grounding to recommend
|
|
46
|
+
</div>
|
|
47
|
+
)}
|
|
48
|
+
</div>
|
|
49
|
+
</details>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { FAILURE_MODES, SUPERCLASS_SUMMARY } from "../lib/failure-modes";
|
|
3
|
+
import { KERNEL_DEFENSES, TOTAL_DEFENSES } from "../lib/defense-registry";
|
|
4
|
+
|
|
5
|
+
export function FailureModesPanel() {
|
|
6
|
+
const [open, setOpen] = useState(false);
|
|
7
|
+
const [tab, setTab] = useState<"modes" | "kernel">("modes");
|
|
8
|
+
const [filter, setFilter] = useState<string | null>(null);
|
|
9
|
+
const [search, setSearch] = useState("");
|
|
10
|
+
|
|
11
|
+
const filteredModes = FAILURE_MODES.filter(fm =>
|
|
12
|
+
(filter ? fm.superclass === filter : true) &&
|
|
13
|
+
(search ? (fm.name + fm.solution + fm.id).toLowerCase().includes(search.toLowerCase()) : true)
|
|
14
|
+
);
|
|
15
|
+
const filteredKernel = KERNEL_DEFENSES.filter(k =>
|
|
16
|
+
search ? (k.name + k.group + k.id + k.wiredIn).toLowerCase().includes(search.toLowerCase()) : true
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className="rounded-2xl border border-zinc-200 bg-white shadow-sm">
|
|
21
|
+
<button onClick={() => setOpen(!open)} className="flex w-full items-center justify-between px-4 py-3 text-left">
|
|
22
|
+
<div className="flex items-center gap-2">
|
|
23
|
+
<span className="text-sm font-bold text-zinc-900">{TOTAL_DEFENSES} Anti-Hallucination Defenses</span>
|
|
24
|
+
<span className="rounded-full bg-indigo-100 px-2 py-0.5 text-[10px] font-bold text-indigo-800">{FAILURE_MODES.length} modes + {KERNEL_DEFENSES.length} kernel</span>
|
|
25
|
+
</div>
|
|
26
|
+
<span className="text-zinc-400 text-sm">{open ? "−" : "+"}</span>
|
|
27
|
+
</button>
|
|
28
|
+
{open && (
|
|
29
|
+
<div className="border-t border-zinc-200 p-3">
|
|
30
|
+
<div className="mb-3 flex items-center gap-2">
|
|
31
|
+
<div className="flex rounded-lg border border-zinc-200 bg-zinc-50 p-0.5">
|
|
32
|
+
<button onClick={() => setTab("modes")} className={`rounded-md px-3 py-1 text-xs font-semibold ${tab === "modes" ? "bg-zinc-900 text-white" : "text-zinc-600"}`}>Failure modes ({FAILURE_MODES.length})</button>
|
|
33
|
+
<button onClick={() => setTab("kernel")} className={`rounded-md px-3 py-1 text-xs font-semibold ${tab === "kernel" ? "bg-zinc-900 text-white" : "text-zinc-600"}`}>Kernel defenses ({KERNEL_DEFENSES.length})</button>
|
|
34
|
+
</div>
|
|
35
|
+
<input value={search} onChange={e => setSearch(e.target.value)} placeholder="Search…"
|
|
36
|
+
className="ml-auto rounded-lg border border-zinc-300 px-3 py-1 text-xs outline-none focus:border-indigo-500 w-40" />
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
{tab === "modes" && (
|
|
40
|
+
<>
|
|
41
|
+
<div className="mb-3 flex flex-wrap gap-1.5">
|
|
42
|
+
<button onClick={() => setFilter(null)} className={`rounded px-2 py-1 text-xs font-medium ${!filter ? "bg-indigo-600 text-white" : "bg-zinc-100 text-zinc-700 hover:bg-zinc-200"}`}>All ({FAILURE_MODES.length})</button>
|
|
43
|
+
{Object.entries(SUPERCLASS_SUMMARY).map(([k, v]) => (
|
|
44
|
+
<button key={k} onClick={() => setFilter(filter === k ? null : k)}
|
|
45
|
+
className={`rounded px-2 py-1 text-xs font-medium ${filter === k ? "bg-indigo-600 text-white" : "bg-zinc-100 text-zinc-700 hover:bg-zinc-200"}`}>
|
|
46
|
+
{k}: {v.name}
|
|
47
|
+
</button>
|
|
48
|
+
))}
|
|
49
|
+
</div>
|
|
50
|
+
<div className="max-h-72 overflow-y-auto rounded-xl border border-zinc-200">
|
|
51
|
+
<table className="w-full text-xs">
|
|
52
|
+
<thead className="sticky top-0 bg-zinc-50">
|
|
53
|
+
<tr className="border-b border-zinc-200">
|
|
54
|
+
<th className="px-3 py-2 text-left font-semibold text-zinc-500 w-12">ID</th>
|
|
55
|
+
<th className="px-3 py-2 text-left font-semibold text-zinc-500">Mode</th>
|
|
56
|
+
<th className="px-3 py-2 text-left font-semibold text-zinc-500">Solution</th>
|
|
57
|
+
</tr>
|
|
58
|
+
</thead>
|
|
59
|
+
<tbody className="divide-y divide-zinc-100">
|
|
60
|
+
{filteredModes.map(fm => (
|
|
61
|
+
<tr key={fm.id} className="hover:bg-zinc-50">
|
|
62
|
+
<td className="whitespace-nowrap px-3 py-2 font-mono font-bold text-indigo-700">{fm.id}</td>
|
|
63
|
+
<td className="px-3 py-2 font-medium text-zinc-900">{fm.name}</td>
|
|
64
|
+
<td className="px-3 py-2 text-zinc-600">{fm.solution}</td>
|
|
65
|
+
</tr>
|
|
66
|
+
))}
|
|
67
|
+
{filteredModes.length === 0 && <tr><td colSpan={3} className="px-3 py-4 text-center text-zinc-400">No matches</td></tr>}
|
|
68
|
+
</tbody>
|
|
69
|
+
</table>
|
|
70
|
+
</div>
|
|
71
|
+
<div className="mt-2 text-[10px] text-zinc-400">Showing {filteredModes.length}/{FAILURE_MODES.length} failure modes</div>
|
|
72
|
+
</>
|
|
73
|
+
)}
|
|
74
|
+
|
|
75
|
+
{tab === "kernel" && (
|
|
76
|
+
<div className="max-h-72 overflow-y-auto rounded-xl border border-zinc-200">
|
|
77
|
+
<table className="w-full text-xs">
|
|
78
|
+
<thead className="sticky top-0 bg-zinc-50">
|
|
79
|
+
<tr className="border-b border-zinc-200">
|
|
80
|
+
<th className="px-3 py-2 text-left font-semibold text-zinc-500 w-12">ID</th>
|
|
81
|
+
<th className="px-3 py-2 text-left font-semibold text-zinc-500">Kernel defense</th>
|
|
82
|
+
<th className="px-3 py-2 text-left font-semibold text-zinc-500">Group</th>
|
|
83
|
+
<th className="px-3 py-2 text-left font-semibold text-zinc-500">Wired in (real code)</th>
|
|
84
|
+
</tr>
|
|
85
|
+
</thead>
|
|
86
|
+
<tbody className="divide-y divide-zinc-100">
|
|
87
|
+
{filteredKernel.map(k => (
|
|
88
|
+
<tr key={k.id} className="hover:bg-zinc-50">
|
|
89
|
+
<td className="whitespace-nowrap px-3 py-2 font-mono font-bold text-emerald-700">{k.id}</td>
|
|
90
|
+
<td className="px-3 py-2 font-medium text-zinc-900">{k.name}</td>
|
|
91
|
+
<td className="px-3 py-2"><span className="rounded bg-zinc-100 px-1.5 py-0.5 text-[10px] text-zinc-700">{k.group}</span></td>
|
|
92
|
+
<td className="px-3 py-2 font-mono text-[10px] text-zinc-500">{k.wiredIn}</td>
|
|
93
|
+
</tr>
|
|
94
|
+
))}
|
|
95
|
+
{filteredKernel.length === 0 && <tr><td colSpan={4} className="px-3 py-4 text-center text-zinc-400">No matches</td></tr>}
|
|
96
|
+
</tbody>
|
|
97
|
+
</table>
|
|
98
|
+
</div>
|
|
99
|
+
)}
|
|
100
|
+
</div>
|
|
101
|
+
)}
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
}
|