Skip to content

Latest commit

 

History

History
324 lines (319 loc) · 30.8 KB

project-structure.md

File metadata and controls

324 lines (319 loc) · 30.8 KB

YUI — Project Structure & Stack

Stack

Layer Technology Version
Shell / OS Tauri v2 (Rust) tauri 2.11.x
Build / dev server Vite 8.x (dev port YUI_DEV_PORT, default 1420; auto-port launchers pick a free port per worktree)
Language TypeScript 6.x (bundler mode, noEmit)
Render three.js 0.180.x
Window UI React 19 with @vitejs/plugin-react (Fast Refresh); the settings pages ported so far, other surfaces are imperative DOM 19.3.x
VRM / motion @pixiv/three-vrm, @pixiv/three-vrm-animation 3.5.x
Voice @ricky0123/vad-web (Silero+ONNX) 0.0.x

Directory Map

A source file's description is its first-line comment.

YUI/                                 # The repository: the app, the Rust shell, the plugins, the integrations, and the docs
  index.html                         # Vite entry
  settings.html                      # Settings-window Vite entry
  devtools.html                      # Developer Tools Vite entry
  message.html                       # Message-window Vite entry
  unified.html                       # Unified-chat-window Vite entry
  threads.html                       # Threads-window Vite entry
  character-menu.html                # Character-menu-window Vite entry
  biome.json                         # Format and lint config (curated rule set)
  scripts/                           # Summarised: dev launchers (dev-port.mjs, tauri-dev.mjs for tauri:dev, dev-auto.mjs) and their shared package-manager.mjs helper, dev-backend-proxy.mjs, release.sh, worktree-setup.sh, rust-lines.sh (code and test line counts of a Rust file), architecture-map-base.mjs (writes the map of origin/main beside the data file for the viewer's Compare view), and ci/ (test-guard.sh, gates.sh, architecture-map.mjs, command-paths.mjs, css-selectors.mjs, logger-namespace.mjs)
  configs/                           # Runtime-loaded config (no hardcoding)
    endpoints.json                   # chat/stt/tts base urls + chat_instructions, chat_api, chat_model_context_window + stt_model/stt_language/tts_provider/tts_model/tts_speaker/tts_max_inflight; the shipped configs/endpoints.json omits the url and speaker keys, and the settings panel overrides per device
    emotion_registry.json            # emotion id -> vrm_expression + fallback
    motions.json                     # Motion registry
    avatar.json                      # VRM avatar config
    filler.json                      # Backed-off filler schedule + first/repeat/long_wait/tool/timeout/unreachable/threads_open/threads_raise phrase pools
    guardrails.json                  # Dispatcher debounce and hourly caps + attachment caps (max_count, max_image_bytes)
    hotkeys.json                     # Global summon accelerator (empty = disabled)
    screen.json                      # Frontmost-transition detector thresholds (dwell/settle/session/gap/quiet)
    persona.json                     # Default card per UI language (en/ja/ko), the framing sentence, and the {{user}} fallback word
    emotion_text/                    # Emoji voice-tag vocabulary, loaded only when tts_provider is irodori (emotion_text/irodori.json)
  public/motions/                    # VRMA motion assets
  src/                               # The client source, in import order: contract, config, renderer, settings, io, dispatcher, ambient, ui, app, and windows
    app/                             # Composes the pet window from the layers below
      active-hours/                  # One pet window's active hours: the proactive gap and idle cue scale, and what holds her turns: Rest and quiet spans
      card-io/                       # The card's file steps bound to a preset registry
      relations/                     # This window's relations wiring
      turn/                          # The path of a turn: sources, voice, and push
        vocabulary/                  # The express vocabulary every consumer declares
        push/                        # Push socket wiring and its stores
        voice/                       # Voice input and speech playback wiring
      stage/                         # What is bound to the pet window's stage and overlay
      dev/                           # DEV-only console handles
      cross-window/                  # State the windows share
      dnd/                           # Do-not-disturb wiring: the root marker that holds the urgent chip's pulse, and the tray's Do Not Disturb check
      controls/                      # The pet window's summonable control surface
      settings/                      # Selections and conversation state applied to the running app
      signal-chips/                  # The signal chips beside the avatar
      threads-reaction/              # Main's Thread reactions: the Threads client, the Threads window, the chip's taps, presence, speech, the turn pipeline, the stage and the renderer
      threads-attach/                # Main's attached Threads, wired by the chat turn in main's window only
      threads-chip/                  # Main's ways into the Threads window: the chip, the tray's Terminal item and a bound Character menu's requests
      pet-windows/                   # Windows bound to one preset: the shared open list, their lifecycle, and the windows each one opens
      message/                       # The message window's wiring, and the character's name both windows' plates and backlogs show
      unified/                       # The unified chat window's wiring
      character-menu/               # The Character menu: its pet-window side and the Character menu window's side
      threads-window/                # The Threads window's wiring
      settings-window/               # The settings window's wiring
    windows/                         # One entry file per window, loaded by the matching HTML file
    contract/                        # TS contract types — the wire schema source of truth
      builtin-client-tools.json      # Built-in client tool names; the MCP host's name conflict rule reads them and a Vitest test checks them against the tool registry
      push-frames.json               # One canonical example of each push frame the backend plugins exchange; the OpenClaw channel plugin's and the Hermes plugin's tests read it
    config/                          # Config load, validate, reactive store, hot-reload, and the runtime URL resolver
      validators/                    # The bundled configs' validators: the avatar sections, the persona card, and the other config files' shapes
        avatar/                      # Validates avatar.json, one file per section
        persona/                     # The card type, the V1/V2/V3 card reader, the V2 export envelope, and the persona.json validation
    renderer/                        # three.js + VRM rendering
      camera/                        # Camera framing, zoom, and orbit state
      geometry/                      # Silhouette hit-testing and read-only model probes
        hit/                         # Alpha-silhouette hit-testing, stage coordinates, and tap regions
        probe/                       # Read-only model probes, anchor projection, and perch math
      motion/                        # Clip scheduling, variant swaps, and clip processing
        clip/                        # Clip cache, mirroring, and root-motion processing
        playback/                    # Motion scheduling, variant swaps, and mixer playback
        yaw/                         # Root-yaw easing math and its per-frame apply
        grounding/                   # Grounding: the per-frame floor height, the sole points, and the sole offset
      expression/                    # Emotion, mouth, and gaze apply layers over the face
        gaze/                        # Cursor-gaze math and its three.js apply layer
    dispatcher/                      # Event bus + classify, guardrail, route
      core/                          # The dispatcher's shared machinery: the event bus, classification, admission, guardrails, the proactive pacer, the turn gate, and the waiting list
      tier1/                         # Tier 1: the local control directives and their rendering, with no backend involved
      turn/                          # The turn's shared state: identity, output, the quoted trigger, push-stop, and the render of a finished turn
      backend/                       # The backend side of a turn: the caller, the stream attempt, the client context, and how the reply settles and records
      sources/                       # The firing sources: typed and spoken user input, and each surface's self-started candidates
        inbox/                       # The inbox-push firing sources
        idle-tick/                   # Idle-gap, clock-time, milestone, and screen firing sources
        gesture/                     # Tap, drag-hold, and window-drop firing sources
          window-drop/               # Drag-release perch settle, armed-perch poll, and placement
        addressed/                   # The character-addressed firing source and the speaking half
        routed/                      # The unified chat window's messages arriving as user turns
        threads/                     # The Threads firing source: a snapshot diff's signal groups and the Threads that left input-required
    ambient/                         # Backend-independent local liveliness and movement
      come-along/                    # Her come-along onto the settings stage
      liveliness/                    # Tier 1 idle-life engine and its cue math
      locomotion/                    # Movement loops: stroll, perch, climb, jump, fall, and sit transitions
        walk/                        # Floor stroll
        perch/                       # Window-top perch and jump
        climb/                       # Window and screen-edge climb
        fall/                        # Fall to the surface below
        travel/                      # Travel frame shared by the stroll, fall, and climb
        hold/                        # Who holds her still
      threads-reaction/              # Thread reactions: the count-edge and long-wait thresholds, and the reaction when she is free
    settings/                        # Persisted user settings, one store per setting, grouped by the part of the app they configure
      appearance/                    # The window theme
      backend/                       # What the backend connection uses
      cues/                          # Proactive and schedule cue lists
      active-hours/                  # Each character's active-hours spans and the card's spans they fall back to
      rest/                          # The Rest record under yui.dnd: a choice and its end, the choices offered at a time, and the state every surface reads
      capture/                       # Screen watching and screenshots
      presence/                      # The user's last presence
      agent-access/                  # The settings a backend agent may read and change through yui_run, and the tier each row takes
      avatar/                        # Camera, motion, and lip-sync
      voice/                         # Filler speech and voice activity detection
      preset/                        # Presets: which keys belong to one, the active one, the registry, and the windows bound to one
      relations/                     # Each preset's relation toward the user and the other presets
      unified/                       # The unified chat window's switch and position
      identity/                      # Who the user is to the character
      threads/                       # The Threads window's own state
      panels/                        # Panel and window state
    io/                              # I/O layer: chat, voice, window and OS seams
      chat/                            # The chat I/O: the transports, client tools, vocabulary, card, conversation state, models, records, and the last emotion
        stream/                        # Streaming model calls and the silence filter
          tool-results/                # Tool results encoded for each request transport
        push/                          # The push transport's turn and reply WebSocket
          tool-results/                # Tool results encoded for push frames
        tools/                         # Declared client tools and the yui API namespaces a window has
          plugins/                     # yui.plugins: the enabled plugins' tools, their results and their argument checks
          terminal/                    # yui.terminal: the shared terminals, through the terminal commands
          threads/                     # yui.threads: the user's Threads as text
          run/                         # yui_run: a backend script in a QuickJS sandbox over the yui API
          screen/                      # The screen query behind yui.look.screen
        vocabulary/                    # The emotion, motion, and voice-tone ids the agent may cue with
        card/                          # The card a preset sends: resolution, assembly with macros, and the greeting pick
        conversation/                  # Transcript, context, and session state for conversation continuation
          overheard/                   # What this window has heard of the other open presets
        models/                        # The chat server's model list
        record/                        # The turn-record JSONL log
        last-emotion/                  # The last emotion a backend cue carried in this window, in memory only
      threads/                         # The Thread store's client
      presence/                        # The user's presence for main's pet window
      mcp-host/                        # The MCP host client and enabled plugin summaries and skills
      terminal/                        # The webview side of the terminals: the snapshot and command client, the clipboard, and the tray's terminal-open event
      voice/                           # The voice I/O: STT through VAD, TTS synthesis and playback, fillers, the speaker catalogue, and the mic's status seams
        filler/                        # TTFT filler phrases spoken while a turn is thinking
        tts/                           # Speech synthesis, in-order playback, and the spoken-text filters
        voices/                        # The speaker catalogue: selection, the voices API, and voice import
      stage/                           # What every stage surface shares for pointer gestures
      window/                          # The window and OS seams: capture, geometry, openers, the pet window's gestures, and the shared window helpers
        capture/                       # Screen enumeration and screenshot capture
        file-drop/                     # A file drag over this window, from the native drag-drop events
        geometry/                      # Monitor and floor math the window movers share
        openers/                       # Openers and placement of the message, settings, devtools, and pet windows, the first two bound to a pet window's preset
        pet/                           # The pet window's own gestures, hit-test, gaze cursor, and peek
          gesture/                     # The three pointer-gesture detectors the stage wires
      bridge/                          # The cross-window bridges: settings, message, delegations, reasoning, push state, and the inbox seam
        core/                          # The cross-window bus every bridge here is built on
        message/                       # The pet ↔ message window bus and its remote half
        delegations/                   # The backend's background-work list, live and persisted
        reasoning/                     # The backend's reasoning text as written and as mirrored
        push/                          # Push socket state mirrored to windows that do not own it
        inbox/                         # The Tauri inbox seam, the channels read through it, and the preset ids the shell routes by
      assets/                          # The user assets: VRM and voice imports, VRM and speaker selection, the card's file steps, and the preset file
        card/                          # The card's file steps: import, export, and the thumbnail URL
        preset-file/                   # The preset file (.yui) and PNG card export steps
      guide/                           # The bundled guide docs handed to the backend on an Ask press
      image/                           # The bitmap → JPEG data URL encode the image paths share
      locks/                           # The exclusive Web Lock a window holds across windows
      snapshot-feed/                   # The webview side of a Rust store's snapshots: the highest revision across its event and command
    ui/                              # Floating surfaces, panels, and indicators
      surfaces/                      # Speech-bubble and text-input host surface
      input/                         # Text entry and its supporting transforms
      commands/                      # The slash-command layer: the input interception, the command listbox, the reply card, and its drag and resize helpers
      message/                       # The bubble and the name plate riding its box in both modes
      unified/                       # The unified chat window
        commands/                    # The unified composer's per-preset backend commands and their reply routing
      signals/                       # The source line of a signal group, shared by the bubble and History
      chips/                         # Status, signal, and delegation chips beside the avatar and on the message-window plate
      notices/                       # One-off and error notices
      threads/                       # The Threads chip and the Threads window
        chip/                        # The Threads chip: the pill counting waiting Threads the user has not picked
        window/                      # The Threads window: its layout, the thread list and rail, the thread pane, the list splitter and resize handles, the panel's grow and hop, the entry Markdown, the relative times, and the turns menu
      ask/                           # The Ask card, its answer area, and the Ask slot's composer
      settings-request/              # The Settings request card
      character-menu/               # The pill menu a right-click on her opens, drawn in the Character menu window, built without React
      use-snapshot/                  # React hooks for sources that return a fresh object each read
      settings-stage/                # The settings window's stage on its left, its slot following the window's size
      quick-controls/                # Settings panel shell parts and sections
        asset-list/                  # The state and rules the VRM and speaker radiogroups share
        voice/                       # The Voice page, rendered with React
          speaker/                   # The speaker list
          filler/                    # The thinking filler
          server/                    # The Voice server section, on top of the Voice page
        body/                        # The Body page, rendered with React
          vrm/                       # The VRM radiogroup
          relations/                 # Relations section
          viewpoint/                 # Camera view reset
        motion/                      # The Motion and desktop page, rendered with React
          gain/                      # Mouth gain
          idle-motion/               # Ambient idle pool
          express-motion/            # Express motion vocabulary
        connection/                  # The Connection page, rendered with React
          setup/                     # The guided part: the lead sentence, the choice of agent and its path, or the connected state
          agent/                     # The agent paths: a copied setup prompt and a socket the page waits for the gateway key on
            socket/                  # The socket path
          connected/                 # The connected state
          quick-start/               # The no-agent path and the free Gemini key
          detail/                    # The chat fields under Set it by hand, rendered with React
          chat/                      # The Chat section of the Connection page, its model list, and its model status
        delegations/                 # The delegated list's sync, which lives with the panel and not with a page
        preset/                      # Preset header above the rail, rendered with React
          photo-dialog/              # The photo dialog
          relations/                 # The relation line under the preset row, and the reasons card
        general/                     # The General page, rendered with React
          help/                      # The General page's help section: one Ask button per bundled guide
          user-name/                 # The General page's user-name row: the device-wide user name field
        history/                     # The History page, rendered with React
          session/                   # The Session section: the context readout and the delegated work
        listening/                   # The Listening page, rendered with React
          silence/                   # The Listening page's silence threshold slider
          readings/                  # The Listening page's reading dictionary: the textarea, its edits, and the skipped lines
          stt-server/                # The STT server fields
        perms/                       # The Permissions page, rendered with React
          monitors/                  # The screen source list
        persona/                     # The Persona page, rendered with React
          active-hours/              # The Active hours editor
          card/                      # The preset's card
        plugins/                     # The Plugins page: installed plugins and the catalog, rendered with React
        proactive/                   # The Proactive page, rendered with React
          pace/                      # How often she speaks up: the pace segment over her day
          advanced/                  # Advanced, folded at the foot of the page
          screen/                    # Screen changes
          threads/                   # Thread reactions
          signals/                   # External signals
          workflows/                 # Workflows in the External signals fold
          cue-list/                  # The schedule and proactive cue lists
        search/                      # Settings search
        together/                    # The Together page, rendered with React
          chain-cap/                 # The cap on characters addressing each other
          characters/                # The page's character list
        sections/                    # The page sections the shell mounts, the rows and lines the Connection, Voice and Listening pages and other sections share, and the list helpers
          endpoint-fields/           # The endpoint field rows the chat, TTS and STT sections share
          server-line/               # The STT and TTS server lines
          status-line/               # The status line the chat, server and plugin lines share: its dot, text and action
          check-line/                # The checking, error and fade lines of a key or server check
          key-entry/                 # The pasted-key row and the key page link
          help/                      # The bundled guides
          key-row/                   # One secret API key row
          push-reason/               # Controls the push transport cannot use
        switches/                    # The React switch rows the Voice, Together, Motion and Proactive pages share
      controls/                      # Shared React controls; the slider, the checkbox, the number field, the segment, the select, the tabs and the tooltip build on Base UI
        tooltip/                     # The Tooltip
        tabs/                        # The Tabs
        slider/                      # The Slider
        number-field/                # The NumberField
        disclosure/                  # The Disclosure
        checkbox/                    # The Checkbox
        switch/                      # The Switch
        select/                      # The Select
        segment/                     # The Segment
      ref-mount/                     # The host a React view gives a vanilla piece
      keyed-rows/                    # Keyed list rows
      listbox/                       # The shared combobox and listbox behaviour of a field: roles, one open owner, and the arrow and enter keys
      scroll-fade/                   # Marks an element whose content sits below its visible part so its bottom edge fades
      theme/                         # The window theme
      i18n/                          # Locale catalogs
      devtools/                      # Developer Tools window, one React root
        motion-preview/              # Motion and emotion preview; its core is lazy-loaded
      terminal/                      # The Threads window's Terminal tab surfaces: the terminal list, the Hangul input, the access line, and the Allow card
  src-tauri/                         # The Rust shell: the Tauri config, the per-window capabilities, and the native source
    tauri.conf.json                  # Transparent always-on-top pet window
    capabilities/                    # Per-window permissions; desktop.json holds the desktop-only plugin permissions
      app-commands.json              # Every app command outside the MCP host, for every window
      plugin-host-call.json          # main and pet-*: the MCP host snapshot, plugin tool calls and their cancel, and skill reads
      plugin-host-manage.json        # settings and settings-*: the MCP host snapshot, the catalog, install and update, remove, add from folder, enable, disable, retry, the log tail, and opening the log folder
    fixtures/mcp-test-plugin/        # Stdlib-only Python MCP server plugin the MCP host tests run
    src/                             # Rust shell
      mcp_host/                      # The MCP host: runs local plugins' MCP servers as YUI-hosted servers
      agent_ingress/                 # The agent-facing HTTP server: signals, avatar RPC, and Threads routes behind the host and origin guard
        threads/                     # The ingress Threads routes: the PUT /threads/<id> parse and its upsert into the ThreadStore
      terminal/                      # The PTY terminals: the terminal_* commands, one Pty per terminal, its ordered input, and the screen reads
      threads/                       # The user's Threads: the model and store, the snapshot commands, and the dated jsonl disk
      preset_file/                   # The preset file (.yui): its manifest and validation, the VRM license inspection, and the PNG card export
      os_event_watcher/              # The OS polling loop: os_event to the webview, the frontmost and idle witness, and the drop-release probe
  fixtures/                          # JSON case tables the TS and Rust sanitizer tests both read
  plugins/                           # Plugins, independent of the app runtime: Rust crates (own `plugins-rust` CI job)
    README.md                        # The official plugins for readers, with the browser demo
    catalog.json                     # The official and community plugins; the plugin release workflow opens a PR that writes the official entries
    browser/                         # ego lite browser MCP server: one `browser` tool, a task space per preset
      src/                           # The browser plugin's Rust source: the MCP server, the `browser` tool, and the run pipeline behind it
    herdr/                           # herdr MCP server: four pane tools and a watcher that signals agent done/blocked (unix)
      src/                           # The herdr plugin's Rust source: the MCP server, its four tools, and the herdr CLI and ssh plumbing
        watch/                       # The watcher: one task per watched server, the ssh forwards, and the state-change signals
  coding-agents/                     # Coding-agent plugins Claude Code and Codex install from the `yui` marketplace
    README.md                        # The coding-agent plugins for readers, their install commands, and the coding-agent Threads
    yui-dev/                         # Skills for a coding agent that extends YUI: `skills/yui-plugin` (BUILD.md, CONTRIBUTE.md) and `skills/yui-wake-character`
    yui-notify/                      # Coding-agent Threads plugin installed from the `yui` marketplace: Claude Code and Codex hooks and `skills/setup`
  integrations/                      # Agent-specific adapters, independent of the YUI app runtime
    hermes/                          # The Hermes Agent adapter: setup docs, the desire middleware, and the gateway's push-transport plugin
      README.md                      # Hermes Agent adapter setup (Responses mode, dev proxy, auth)
      desire/                        # Agent desire middleware, state helpers, monitor, and prompts (Python/uv)
      platform/                      # Hermes gateway push-transport plugin: one WebSocket carrying turns in and finished replies out (Python/uv)
        yui/src/tools/               # The client-declared tools: registration from hello.tools and tools frames, the blocking handler, and the per-chat pending calls
    openclaw/                        # The OpenClaw integration: the OpenClaw channel plugin that serves the push transport, the integration notes, and the connection setup skill
      README.md                      # OpenClaw integration: the plugin route, what works, security and cost
      channel/                       # The OpenClaw channel plugin `openclaw-yui` (TypeScript, its own npm package): the push-transport socket, turns into OpenClaw sessions, replies out as push frames
      skills/yui-openclaw-setup/     # Step-by-step gateway and YUI connection setup with a check per step, and a symptom table
  skills/                            # Skill folders for the character's backend agent, copied into the agent's skill folder or fetched by raw URL
    README.md                        # The skills for readers: what each one teaches and how an agent takes it
    thread-producer/                 # Backend-agnostic skill: a producer posts outside conversations (PRs, mail, chat) as view-only Threads, and the backend acts in the source when the user asks
    yui-daily-briefing/              # Backend-agnostic skill: scheduled producers write dated markdown briefings (scripts/briefing.py) that the backend agent speaks on first activity
  mocks/                             # Standalone HTML mocks, one folder per screen; they link src/ui stylesheets by relative path (README.md)
  docs/                              # Design source of truth
    agent-guide/architecture/        # Architecture map of the client
      map.js                         # Modules, their parts, exchanges, and flows of src/ and src-tauri/src
      index.html                     # Viewer that draws a map data file when opened from disk