Expand description
§CVKG Agentic Development Guidelines (v1.2)
All AI agents contributing to this crate MUST follow ALL seven rules:
── Karpathy Guidelines (1–4) ────────────────────────────────────────────
- THINK FIRST — State assumptions. Surface ambiguity. Push back on complexity.
- STAY SIMPLE — Minimum code. No speculative features. No unasked-for abstractions.
- BE SURGICAL — Touch only what’s required. Own your orphans. Don’t improve neighbors.
- VERIFY GOALS — Turn tasks into checkable criteria. Loop until they pass. Never commit broken.
── CVKG Extended Protocols (5–7) ──────────────────────────────────────── 5. TRIPLE-PASS — Read the target, its surrounding context, and its full call graph 6. COMMENT ALL — Every major pub fn, unsafe block, and non-trivial algorithm in 7. MONITOR LOOPS — Check every tool call / command for progress every 30 seconds.
Sources: The View trait is the fundamental building block of CVKG. Every UI element — from a plain text label to a complex navigation controller — is a View. The trait is intentionally minimal; complexity emerges through modifier composition.
§Conformance rules:
body()must be pure and side-effect free- Primitive views use
NeverasBodyand register aPaintCommanddirectly with the scene graph Viewtypes must implementSendbut not necessarilySync, enabling safe multi-threaded layout passes
Re-exports§
pub use layout::LayoutCache;pub use layout::LayoutKey;pub use layout::LayoutView;pub use layout::Rect;pub use layout::SizeProposal;pub use material::DrawMaterial;pub use scene_graph::NodeId;pub use scene_graph::bifrost_registry;pub use color::SemanticColors;pub use audio_haptic::AudioEngine;pub use audio_haptic::HapticEngine;pub use audio_haptic::HapticIntensity;pub use audio_haptic::NullAudioEngine;pub use audio_haptic::NullHapticEngine;pub use audio_haptic::haptic_error;pub use audio_haptic::haptic_impact;pub use audio_haptic::haptic_selection;pub use audio_haptic::haptic_success;pub use audio_haptic::play_sound;pub use audio_haptic::set_audio_engine;pub use audio_haptic::set_haptic_engine;pub use audio_haptic::sounds;
Modules§
- accessibility
- Utility for accessibility compliance (WCAG 2.1).
- agents
- CVKG Multi-Agent Conflict Resolution Subsystem
- animation
- Spring-physics animated value wrapper.
- audio_
haptic - Audio and Haptic Feedback — Item 14
- color
- env
- Ambient environment management
- error_
types - Custom error types for CVKG UI components Provides better error messages with span information and suggested fixes
- gpu
- GPU batching interface for efficient draw-call submission.
- layout
- material
- Material System and Shader Composition
- runtime
- scene_
graph - Scene Graph and View Identity
- sdf_
shadow - Screen-space SDF shadow types and raymarching parameters.
- security
Structs§
- Accessibility
Preferences - System accessibility preferences that components and the renderer must honor.
- AnyView
- A type-erased View wrapper.
- Appearance
Key - Key for accessing the current system appearance
- Aria
Properties - Accessible properties for a view, describing its semantic role and state.
- Asset
Key - Auto
Save Manager - Periodic auto-save coordinator for open Documents.
- Background
Modifier - A modifier that adds a background color to a view.
- Bifrost
Bridge Modifier - BifrostBridgeModifier enables shared-element transitions. When two views share the same Bifrost Bridge ID, the Sleipnir solver will interpolate their geometry and effects (blur, glow) during the transition.
- Bifrost
Layer Modifier - BifrostLayerModifier themes a view based on its cognitive memory layer. Episodic: Shifting aurora clouds. Semantic: Crystalline gold. Procedural: Heavy obsidian stone.
- Bifrost
Modifier - BifrostModifier implements the Cyberpunk “Frosted Glass” aesthetic. It triggers backdrop blurring and light scattering in the render pipeline.
- Binding
- A read/write projection into a
State<T>owned elsewhere. - Border
Modifier - BorderModifier draws a solid-color border around the view bounds.
- Camera3D
- Camera definition for 3D rendering.
- Clip
Modifier - ClipModifier restricts all child drawing to the view’s layout rectangle.
The renderer must support
push_clip_rect/pop_clip_rect. - Color
- A color represented by RGBA components in the [0.0, 1.0] range.
- Color
Theme - Fully themeable color palette for the Berserker pipeline.
- Component
Error State - Error state for fault isolation at the component level.
- Default
Asset Manager - A basic implementation of AssetManager that can be overridden by platform backends.
- Default
Notification Handler - Default in-app notification handler that writes state to KnowledgeState.
- Edge
Insets - Insets for padding
- Elevation
Modifier - Modifier to add elevation (shadow) to a view
- Empty
View - EmptyView - A view that renders nothing and takes up no space.
- Environment
- Environment wrapper for accessing ambient values
- Fafnir
Modifier - FafnirModifier enables self-evolving UI capabilities. Named after Fafnir, the dragon who grows in power based on the gold he hoards. In CVKG, ‘Gold’ is user attention/interaction.
- File
Dialog - Dialog options for picking files or directories.
- File
Filter - Filter mapping name to extension list for a file dialog.
- Flex
Modifier - Modifier to set the flex weight of a view
- Focus
Manager - Manages focus order, Tab/Shift+Tab navigation, and focus traps.
- Focus
Trap - Focus trap for confining Tab navigation (e.g., modals).
- Focusable
Id - Unique ID for a focusable element.
- Foreground
Color Modifier - ForegroundColorModifier overrides the foreground (text / icon) color inherited by all descendants until another ForegroundColorModifier is encountered.
- Frame
Budget - Configuration for render-loop frame timing and degradation strategies.
- Frame
Modifier - Modifier to set the size and alignment constraints of a view. This determines the proposal size passed to the child and how the child is aligned within the layout rect allocated to the frame.
- Grid
Placement - Placement configuration for placing a view within a Grid layout.
- Grid
Placement Modifier - Modifier that specifies the column and row placement of a view inside a Grid layout.
- Gungnir
Modifier - GungnirModifier implements the “Neon Glow” aesthetic. It uses additive blending and multi-pass blurring to simulate glowing light.
- Gungnir
Pulse Modifier - GungnirPulseModifier implements a “breathing” neon effect.
- KeyModifiers
- Modifier keys for keyboard events.
- KeyShortcut
- A keyboard shortcut binding.
- Keyboard
Shortcut - A keyboard shortcut binding to a menu action.
- Knowledge
Fragment - A knowledge fragment stored in the memory system
- Knowledge
State - Knowledge state for the agentic memory system.
- Kvasir
Vibe Modifier - KvasirVibeModifier renders a cognitive telemetry cloud representing agent complexity.
- L10n
- Global localization manager.
- L10n
Bundle - Layout
Constraints - Layout constraints for views
- Layout
Modifier - Modifier to set layout constraints
- Lifecycle
Modifier - LifecycleModifier handles on_appear and on_disappear hooks.
- Magnetic
Modifier - MagneticModifier makes a view “magnetic”, subtly leaning towards or pulling the cursor.
- Mani
Glow Modifier - ManiGlowModifier adds a soft, lunar-like cursor glow to a view. Named after Máni, the personification of the Moon.
- Material3D
- Material properties for 3D rendering.
- Memo
View - A view that memoizes its rendering based on a stable ID and data hash. The renderer can use this to skip re-rendering the sub-tree if the data hasn’t changed.
- MenuBar
- A top-level menu bar containing
MenuItems. - Mesh
- A 3D mesh containing vertex and index data.
- Mimir
Intent Modifier - MimirIntentModifier anticipates user movement and manifests holographic ghosts.
- Mjolnir
Shatter Modifier - MjolnirShatterModifier implements the “Shattering” effect. It breaks the view into discrete geometric fragments that can be animated.
- Mjolnir
Slice Modifier - MjolnirSliceModifier implements the “Geometric Slice” aesthetic. It uses a signed distance field (SDF) to clip the view along a sharp angled line.
- Modified
View - A view that has been transformed by a modifier. Section 4.3: “Each modifier implements ViewModifier and produces a ModifiedView<Inner, Self>.”
- Modifiers
- Keyboard modifier flags used by
KeyboardShortcut. - Notification
- A structured notification representation.
- Notification
Action - Action details for interactive buttons inside a notification.
- Odins
EyeModifier - OdinsEyeModifier bestows omniscient observability over the entire scene graph.
- Offset
Modifier - Modifier to offset a view
- OnClick
Modifier - OnClickModifier registers a click handler for this view.
- OnPointer
Down Modifier - OnPointerDownModifier registers a pointer down handler.
- OnPointer
Enter Modifier - OnPointerEnterModifier registers a pointer enter handler.
- OnPointer
Leave Modifier - OnPointerLeaveModifier registers a pointer leave handler.
- OnPointer
Move Modifier - OnPointerMoveModifier registers a pointer move handler.
- OnPointer
UpModifier - OnPointerUpModifier registers a pointer up handler.
- Opacity
Modifier - OpacityModifier fades this view and all its descendants to the given alpha.
The renderer is expected to honour
push_opacity/pop_opacityon the Renderer trait. - Overlay
Modifier - Modifier to render a popover, tooltip, or menu view overlaying an anchored view. It supports alignment positioning and outside-click dismissal.
- Padding
Modifier - A modifier that adds padding to a view.
- Safe
Area Modifier - Modifier to handle platform safe areas
- Scene
Uniforms - Per-frame scene state for the Berserker pipeline.
- Size
- Geometry modifiers Size of the view in logical pixels
- Sleipnir
Modifier - SleipnirModifier handles physics-based animations via the Sleipnir RK4 solver.
- Sleipnir
Params - Sleipnir spring parameters for the physics solver
- Sleipnir
Solver - SleipnirSolver implements a 4th-order Runge-Kutta (RK4) integration for springs. This provides superior stability for high-fidelity interactive motion.
- State
- State wrapper that owns a value and notifies subscribers when changed
- Style
Resolver - StyleResolver provides high-level access to themed values from the environment.
- Suspense
- Suspense wrapper for asynchronous state management.
Integrates with State
to provide loading/error/ready states for async operations. - System
Clipboard - Default clipboard implementation using
arboard. Note: This is only available when thearboardfeature is enabled. The renderer provides the concrete implementation. - Telemetry
Data - TelemetryData tracks real-time performance metrics for the GPU renderer.
- Temporal
Edge - An edge in the Temporal Graph representing a relationship between nodes
- Temporal
Node - Text
Input State - Text input state managed by the renderer.
- Transform3D
- A 3D transform: position, rotation (quaternion), and scale.
- Transform
Modifier - TransformModifier applies a 2D transform (translation, scale, rotation) to its child. This modifier is “layout-neutral” and can be animated without re-running the layout engine.
- Undo
Group - A single action group representing an undo/redo step.
- Undo
Manager - Unified manager for undo and redo stacks. Supports grouping of actions, max undo depth clamping, and coalescing.
- Window
Config - Configuration settings for creating a new window.
- Window
Handle - A handle to a native window that can be used by application code.
- Window
Id - Unique identifier for a window instance.
- Yggdrasil
Key - Key for accessing the Yggdrasil design token tree
- Yggdrasil
Tokens - YggdrasilTokens is the authoritative container for all design tokens in the CVKG ecosystem.
- ZIndex
Modifier - Modifier to set the z-index of a view
Enums§
- Alignment
- Cross-axis alignment for layout containers.
- Announcement
Priority - Priority for screen reader announcements via
Renderer::announce. - Appearance
- System appearance (Light/Dark mode)
- Aria
Role - Semantic role for assistive technology (WCAG 2.1 §4.1.2).
- Asset
State - Asset state for async resource loading.
- Berserker
Mode - Berserker mode states for the rendering pipeline.
- Direction
- Layout direction for UI elements (LTR or RTL).
- Distribution
- Main-axis distribution for linear layout containers.
- Document
Error - Error type representing a failure in Document load/save/parse operations.
- Event
- User input event types
- Event
Response - Response from an event handler
- File
Dialog Error - Errors returned by the file dialog.
- File
Dialog Mode - The mode/purpose of the file dialog.
- Memory
Layer - Memory layers for the layered cognitive engine
- Menu
Item - A single entry in a
MenuBar. - Notification
Error - Error type indicating a failure in generating or posting a notification.
- Notification
Permission - State of notification permissions.
- Notification
Priority - Priority tier of a notification.
- Orientation
- Orientation for layouts
- Realm
- The operational Realm of the UI. Midgard: Classic, functional, 2D tactical UI for mortals. Asgard: High-fidelity, cognitive, shader-heavy UI for the Singularity.
- Render
Tier - Defines the hardware acceleration tier and feature set available to the renderer.
- System
Theme - The detected system theme.
- Text
Direction - Direction for cursor movement in text input.
- Token
Value - Design token value that can adapt to light/dark mode
- Touch
Phase - The phase of a touch or gesture event in its lifecycle.
- Window
Close Action - Action to take when a window close request event is received.
- Window
Level - Specifies the layering behavior of the window relative to other windows.
Constants§
Statics§
- IS_
RENDERING - LAYOUT_
DIRTY - SYSTEM_
STATE - Global application state registry.
Traits§
- Asset
Manager - AssetManager defines the interface for loading and caching external resources.
- Clipboard
Provider - Trait for clipboard operations.
- Document
- A document interface mapping to local filesystem persistence.
- Elapsed
Time - The Renderer trait defines the atomic drawing operations for all CVKG backends. This trait is object-safe and used by the View::render system.
- EnvKey
- Environment key type for accessing ambient values Implement this trait to define a new environment key.
- Erased
View - An object-safe version of the View trait for type erasure.
- Frame
Renderer - FrameRenderer extends Renderer with frame lifecycle management. It is typically implemented by the host windowing/rendering environment.
- Notification
Handler - Core interface for routing and dispatching notification events.
- Renderer
- The Renderer trait defines the atomic drawing operations for all CVKG backends. This trait is object-safe and used by the View::render system.
- Seer
- Seer trait for AI-assisted UI components. Allows components to receive “prophecies” (predictions) from an AI backend.
- View
- View
Modifier - Window
- Abstract trait representing a platform-native window. Implementations delegate calls back to the platform renderers and events.
Functions§
- accessibility_
preferences - Get the current accessibility preferences for this thread.
- batch
- Executes multiple state updates in a single batch, deferring all subscriber notifications until the closure completes. This prevents layout thrashing and redundant render cycles when modifying multiple independent states.
- begin_
render_ phase - Signals the start of the render phase. Mutations during this phase trigger warnings.
- clear_
current_ theme - Clear the current theme. Called after each frame.
- current_
locale - default_
tokens - The authoritative Cyberpunk Viking default tokens
- detect_
system_ theme - Detect the current system theme.
- effective_
duration - Returns effective animation duration (0.0 if reduced motion is active).
- end_
render_ phase - Signals the end of the render phase.
- enqueue_
batch_ task - Enqueues a notification task to be run when the current batch flushes.
- get_
notification_ handler - Gets the global notification handler, fallback to DefaultNotificationHandler.
- get_
system_ state - Get a reference to the global system state.
- init_
l10n - is_
batching - Returns true if state updates are currently being batched.
- is_
reduced_ motion - Detects OS-level reduced motion preference.
- is_
rendering - Returns true if the system is currently in the render phase.
- is_rtl
- l10n
- load_
system_ state - set_
accessibility_ preferences - Set the accessibility preferences for this thread.
- set_
current_ theme - Set the current semantic colors for this thread. Called by the native renderer before each frame.
- set_
locale - set_
notification_ handler - Sets the global notification handler.
- t
- tf
- transact_
pair - transact_
system_ state - update_
system_ state - use_
state - Local state hook for components.
- use_
state_ hash - Generate a stable hash ID from a string key.
- use_
theme - Access the current semantic colors from within a component’s
render()method.
Type Aliases§
- Knowledge
Id - Unique identifier for knowledge fragments