memlnaut-nisps/manifold/src/App.tsx

83 lines
2.5 KiB
TypeScript
Raw Normal View History

/**
* Manifold app root. The convertible Console (ConsoleApp) wired to the real
refactor(manifold): delete the dead console UI stratum Phase 1 group 5 (S15, S16, S18, S19, L22, L23, L20, L21, L1 delete-half). - S15: the four-way focus/altitude system. setFocus was never called anywhere, so only the 'composite' branch was reachable. Deleted SplitStage, ReadoutStrip, InputMini, AltitudeNav, CompactAxis, the UI Focus type/prop, the focus branches, stripPinned and the vacuous keyboard gates. MiniMeters kept; engine.feedback.setFocus (a different, live thing) untouched. - S16 + L1: the decorative stratum that rendered real-looking controls driving nothing — A/B machinery, the fake seed, seededGradient + weightsRevision, snapshots, master volume, bpm, and the learningRate/decay/tame/spreadLevel sliders with their Drawers rows. Each was confirmed self-referential first. NOTE a real behaviour change falls out of dropping `snapshots`: Undo outside an active explore-and-place session used to pop a UI-only snapshot that restored noiseCap/seed. It is now simply inactive unless a genuine core-backed scratchpad undo exists. Geometric-dislike mode never had a real undo primitive in the core, so only the fake path is gone. - S18: BackendAdvanced.tsx and its Drawers block. It self-described as a duplicate of the inline OutputsBackendConfig editor and BOTH rendered in the same expanded drawer. OutputsBackendConfig already covers every backend. - S19: pruned ConsoleCtx to the fields Dock/Drawers/OutputsBackendConfig actually read; deleted the Axes type + axes/setAxis and the preset/setPreset/offsetActive chain (permanently 'Sculpt'/false). KEPT ctx.modes and ctx.setModeId despite having no reader today — the Phase 5 instrument picker (§7.6, adopted) is built on exactly that plumbing. - L22: the 5 dead primitives (Panel, StatusLine, ControlAxis, CurvePlot, Sparkline) and their barrel exports, plus the now-dead .mf-axis-input CSS. - L23: OutputControl/toOutputControl, ModeIconComponent and the BACKENDS catalogue; Drawers now reads modeDesc.label/description from OUTPUT_MODES, the surviving single catalogue. - L20: the solo-mode selector's two unimplemented options no longer pretend to be selectable. - L21: FeedbackController vestiges — seed/undoDepth options, maxUndo, and six ControllerEngine members nothing called (the finding named three; the other three are used on the real EngineApi by debug/probe.ts, a different interface, so removing them from ControllerEngine is safe). Gates: run-all-tests.sh ALL GREEN (typecheck, 33 Playwright specs).
2026-07-21 12:49:25 +02:00
* engine, mounted under EngineProvider. ConsoleApp renders its single
* "composite" stage unconditionally (the dead focus/altitude system was
* deleted 2026-07 simplification audit S15). The `?debug=1` probe is
* installed once the engine is live.
*/
import { useEffect } from 'react';
import { EngineProvider } from './engine/EngineProvider';
feat(manifold): geometric dislike + jolt/OU via shared core (one-core-engine P3) TS half of P3.1/P3.2/P3.3: wire the new WASM exports and delete the TS approximations now that geometric-dislike, jolt, OU, and the seeded RNG live in the C++/WASM core. - types.ts/wasm-iml.ts: bind + wrap dislike_geometric, store_positive, positive/negative_count, set_avoid_style, jolt_press/step/release/active/ lr_scale/tick_lr_ramp, explore_intensity/get/apply. Weight-mutating wrappers republish weights (version bump); explore_apply reuses feedbackBuf. - engine-api: extend .feedback (dislikeGeometric/storePositive/counts/ setAvoidStyle) + new .explore facade. thumbsDown now passes the HEARD (routed) vector, not the raw MLP output (raw == net output => inert cold-start). - feedback/controller.ts: delete dislikes[] + applyDislikeBias + both C++ GAP blocks + the SeededRng field; dislike() -> core dislikeGeometric (returns action, 15 => cold-start prompt); like() feeds the centroid via the core thumbsUp; getState() exposes positive/negative counts. Delete feedback/rng.ts. - engine/exploration.ts: execute the P3 SWAP POINT -> drive engine.explore.*; delete engine/jolt.ts + ou-explore.ts. UI surface unchanged. - ConsoleApp: one-time cold-start banner (British spelling), routed heard vector at the dislike call site. - App.tsx/spine.ts: under ?debug=1 pin a fixed seed + fixed per-tick dt so the probe/e2e are deterministic (production keeps time-seeded, real-time dt). - tests: new geo-dislike.spec.ts; probe gains dislikeGeometric/storePositive/ feedbackCounts/setAvoidStyle; the thumbsDown probe test now drives a real distinct-heard-vector dislike (bare thumbsDown on the net's own output is correctly inert under the geometric core). 27 e2e + 9 unit green. Docs: manifold/ONBOARDING.md engine+feedback sections synced.
2026-07-14 04:54:27 +02:00
import type { EngineApiOptions } from './engine/engine-api';
import { useEngine } from './engine/useEngine';
import { installDebugProbe } from './debug/probe';
import { ConsoleApp } from './console';
feat(manifold): geometric dislike + jolt/OU via shared core (one-core-engine P3) TS half of P3.1/P3.2/P3.3: wire the new WASM exports and delete the TS approximations now that geometric-dislike, jolt, OU, and the seeded RNG live in the C++/WASM core. - types.ts/wasm-iml.ts: bind + wrap dislike_geometric, store_positive, positive/negative_count, set_avoid_style, jolt_press/step/release/active/ lr_scale/tick_lr_ramp, explore_intensity/get/apply. Weight-mutating wrappers republish weights (version bump); explore_apply reuses feedbackBuf. - engine-api: extend .feedback (dislikeGeometric/storePositive/counts/ setAvoidStyle) + new .explore facade. thumbsDown now passes the HEARD (routed) vector, not the raw MLP output (raw == net output => inert cold-start). - feedback/controller.ts: delete dislikes[] + applyDislikeBias + both C++ GAP blocks + the SeededRng field; dislike() -> core dislikeGeometric (returns action, 15 => cold-start prompt); like() feeds the centroid via the core thumbsUp; getState() exposes positive/negative counts. Delete feedback/rng.ts. - engine/exploration.ts: execute the P3 SWAP POINT -> drive engine.explore.*; delete engine/jolt.ts + ou-explore.ts. UI surface unchanged. - ConsoleApp: one-time cold-start banner (British spelling), routed heard vector at the dislike call site. - App.tsx/spine.ts: under ?debug=1 pin a fixed seed + fixed per-tick dt so the probe/e2e are deterministic (production keeps time-seeded, real-time dt). - tests: new geo-dislike.spec.ts; probe gains dislikeGeometric/storePositive/ feedbackCounts/setAvoidStyle; the thumbsDown probe test now drives a real distinct-heard-vector dislike (bare thumbsDown on the net's own output is correctly inert under the geometric core). 27 e2e + 9 unit green. Docs: manifold/ONBOARDING.md engine+feedback sections synced.
2026-07-14 04:54:27 +02:00
/**
* Engine options derived from the URL. Under `?debug=1` (the Playwright /
* dev-probe gate) we pin a FIXED RNG seed so the net's initial weights and
* therefore inference, feedback, and reshape behaviour are deterministic run
* to run. Production (no debug flag) keeps the time-seeded default, so this
* never changes what a real user hears.
*/
function engineOptions(): EngineApiOptions {
if (typeof window === 'undefined') return {};
try {
const params = new URLSearchParams(window.location.search);
// Fixed seed + fixed per-tick dt ⇒ deterministic weights AND deterministic
// pipeline smoothing (the pipelines otherwise read performance.now()).
if (params.get('debug') === '1') return { seed: 0xc0ffee, debugClockDt: 1 / 60 };
} catch {
/* no URL (SSR / sandbox) — fall through */
}
return {};
}
function Loading() {
return (
<div
style={{
position: 'absolute',
inset: 0,
background: 'var(--bg)',
color: 'var(--fg)',
fontFamily: 'var(--font-mono)',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
gap: 'var(--sp-3)',
}}
>
<strong
style={{
color: 'var(--accent)',
fontSize: 'var(--fs-2xl)',
letterSpacing: 'var(--ls-tight)',
}}
>
Manifold
</strong>
<span style={{ color: 'var(--fg-dim)', fontSize: 'var(--fs-xs)' }}>loading engine</span>
</div>
);
}
/** Installs the debug probe once the engine is in context. */
function ProbeInstaller() {
const engine = useEngine();
useEffect(() => {
if (engine) installDebugProbe(engine);
}, [engine]);
return null;
}
export function App() {
return (
feat(manifold): geometric dislike + jolt/OU via shared core (one-core-engine P3) TS half of P3.1/P3.2/P3.3: wire the new WASM exports and delete the TS approximations now that geometric-dislike, jolt, OU, and the seeded RNG live in the C++/WASM core. - types.ts/wasm-iml.ts: bind + wrap dislike_geometric, store_positive, positive/negative_count, set_avoid_style, jolt_press/step/release/active/ lr_scale/tick_lr_ramp, explore_intensity/get/apply. Weight-mutating wrappers republish weights (version bump); explore_apply reuses feedbackBuf. - engine-api: extend .feedback (dislikeGeometric/storePositive/counts/ setAvoidStyle) + new .explore facade. thumbsDown now passes the HEARD (routed) vector, not the raw MLP output (raw == net output => inert cold-start). - feedback/controller.ts: delete dislikes[] + applyDislikeBias + both C++ GAP blocks + the SeededRng field; dislike() -> core dislikeGeometric (returns action, 15 => cold-start prompt); like() feeds the centroid via the core thumbsUp; getState() exposes positive/negative counts. Delete feedback/rng.ts. - engine/exploration.ts: execute the P3 SWAP POINT -> drive engine.explore.*; delete engine/jolt.ts + ou-explore.ts. UI surface unchanged. - ConsoleApp: one-time cold-start banner (British spelling), routed heard vector at the dislike call site. - App.tsx/spine.ts: under ?debug=1 pin a fixed seed + fixed per-tick dt so the probe/e2e are deterministic (production keeps time-seeded, real-time dt). - tests: new geo-dislike.spec.ts; probe gains dislikeGeometric/storePositive/ feedbackCounts/setAvoidStyle; the thumbsDown probe test now drives a real distinct-heard-vector dislike (bare thumbsDown on the net's own output is correctly inert under the geometric core). 27 e2e + 9 unit green. Docs: manifold/ONBOARDING.md engine+feedback sections synced.
2026-07-14 04:54:27 +02:00
<EngineProvider options={engineOptions()} fallback={<Loading />}>
<ProbeInstaller />
refactor(manifold): delete the dead console UI stratum Phase 1 group 5 (S15, S16, S18, S19, L22, L23, L20, L21, L1 delete-half). - S15: the four-way focus/altitude system. setFocus was never called anywhere, so only the 'composite' branch was reachable. Deleted SplitStage, ReadoutStrip, InputMini, AltitudeNav, CompactAxis, the UI Focus type/prop, the focus branches, stripPinned and the vacuous keyboard gates. MiniMeters kept; engine.feedback.setFocus (a different, live thing) untouched. - S16 + L1: the decorative stratum that rendered real-looking controls driving nothing — A/B machinery, the fake seed, seededGradient + weightsRevision, snapshots, master volume, bpm, and the learningRate/decay/tame/spreadLevel sliders with their Drawers rows. Each was confirmed self-referential first. NOTE a real behaviour change falls out of dropping `snapshots`: Undo outside an active explore-and-place session used to pop a UI-only snapshot that restored noiseCap/seed. It is now simply inactive unless a genuine core-backed scratchpad undo exists. Geometric-dislike mode never had a real undo primitive in the core, so only the fake path is gone. - S18: BackendAdvanced.tsx and its Drawers block. It self-described as a duplicate of the inline OutputsBackendConfig editor and BOTH rendered in the same expanded drawer. OutputsBackendConfig already covers every backend. - S19: pruned ConsoleCtx to the fields Dock/Drawers/OutputsBackendConfig actually read; deleted the Axes type + axes/setAxis and the preset/setPreset/offsetActive chain (permanently 'Sculpt'/false). KEPT ctx.modes and ctx.setModeId despite having no reader today — the Phase 5 instrument picker (§7.6, adopted) is built on exactly that plumbing. - L22: the 5 dead primitives (Panel, StatusLine, ControlAxis, CurvePlot, Sparkline) and their barrel exports, plus the now-dead .mf-axis-input CSS. - L23: OutputControl/toOutputControl, ModeIconComponent and the BACKENDS catalogue; Drawers now reads modeDesc.label/description from OUTPUT_MODES, the surviving single catalogue. - L20: the solo-mode selector's two unimplemented options no longer pretend to be selectable. - L21: FeedbackController vestiges — seed/undoDepth options, maxUndo, and six ControllerEngine members nothing called (the finding named three; the other three are used on the real EngineApi by debug/probe.ts, a different interface, so removing them from ControllerEngine is safe). Gates: run-all-tests.sh ALL GREEN (typecheck, 33 Playwright specs).
2026-07-21 12:49:25 +02:00
<ConsoleApp />
</EngineProvider>
);
}