Repository navigation
feat(demo): Security Theater + unified shell + a11y/motion polish - #9
Merged
Merged
Conversation
Three "next steps" in one pass.
1) Security & cache-write theater (new surface /security)
- demo/security.py β SecurityEngine drives the real
konjoai.cache.poisoning.PoisoningGuard unmodified: per-tenant
WriteRateLimiter, cosine Q-A coherence (identical _cosine_similarity),
and the Welford AnomalyDetector. Authoritative accept/reject comes from
guard.validate(); per-layer diagnostics are read from the guard's own
components so the explanation always matches the verdict. Only the demo
encoder is substituted (the guard's embed_fn seam). A curated, fully
deterministic scenario exercises every layer (coherent baselines β
poisoned/off-topic β length anomaly β rate-limit flood).
- demo/security.html β cinematic "write firewall": three gate counters,
an animated verdict timeline with per-layer signal bars, an OWASP-safe
threat ledger (SHA-256 hashes only), and an interactive "test your own
write" panel.
- demo/server.py β GET /security, GET /api/security/{scenario,stats},
POST /api/security/{check,reset} (bounded inputs).
- tests/unit/test_demo_security.py β 11 contract tests (each layer fires,
OWASP no-raw-text, interactive check/reset).
2) Unified shell β cross-document View Transitions (@view-transition:
navigation auto) on all five surfaces for smooth page-to-page morphs, and
a consistent nav with Security linked everywhere (Playground Β· Observatory
Β· Pipeline Β· Agent Β· Security).
3) Polish across pages β prefers-reduced-motion honoured (animations +
view-transitions disabled), :focus-visible rings for keyboard nav,
aria-current / aria-live on the new surfaces, and responsive grids that
stack on narrow viewports.
36 demo tests pass (stable across PYTHONHASHSEED); ruff clean repo-wide.
https://claude.ai/code/session_01WWWgV1NwxaaNdPfy4PHN1K
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Delivers all three remaining next-steps in one pass, on top of the Pipeline (#7) and Agent (#8) theaters.
1. Security & cache-write theater β new surface
/securityVisualizes kyro's real
konjoai.cache.poisoning.PoisoningGuardas a live "write firewall".demo/security.pyβSecurityEngineruns the guard unmodified: per-tenantWriteRateLimiter, cosine Q-A coherence (the identical_cosine_similarity), and the WelfordAnomalyDetector. The authoritative accept/reject isguard.validate(); the per-layer diagnostics the UI shows are read from the guard's own components, so the explanation always matches the decision. The only substitution is the demo encoder β exactly theembed_fnseam the guard already exposes. A curated, fully deterministic scenario (FNV-hash encoder, not Python's saltedhash()) exercises every layer: coherent baselines β poisoned/off-topic (blocked at coherence) β padded answer (flagged for length anomaly) β bot flood (trips the rate limiter).demo/security.htmlβ cinematic firewall: three gate counters (pass/block/flag), an animated verdict timeline with per-layer signal bars, an OWASP-safe threat ledger (SHA-256 hashes only), and an interactive "test your own write" panel.demo/server.pyβGET /security,GET /api/security/{scenario,stats},POST /api/security/{check,reset}(bounded inputs).tests/unit/test_demo_security.pyβ 11 contract tests: each layer fires, OWASP no-raw-text (only 16-hex hashes), interactive check/reset.2. Unified shell
Cross-document View Transitions (
@view-transition { navigation: auto }) on all five surfaces for smooth page-to-page morphs, and a consistent nav with Security linked everywhere: Playground Β· Observatory Β· Pipeline Β· Agent Β· Security.3. Polish across pages
prefers-reduced-motionhonoured (animations + view-transitions disabled) on every surface.:focus-visiblerings for keyboard navigation.aria-current/aria-liveon the new surfaces; responsive grids that stack on narrow viewports.Honesty notes
config.embed_fn.Verification
PYTHONHASHSEEDvalues;ruff check .clean repo-wide.200; the security scenario returns its 14-row timeline; the off-topic interactive check returnsblocked / coherence.demo/*and a new test changed β no productionkonjoai/code touched.Run it:
python3 demo/server.py # http://localhost:8766/securityhttps://claude.ai/code/session_01WWWgV1NwxaaNdPfy4PHN1K
Generated by Claude Code