Seed Gjallar compositor product

This commit is contained in:
Meta Vens 2026-06-05 18:31:09 +01:00
commit f572b29994
7 changed files with 2396 additions and 0 deletions

7
.gitignore vendored Normal file
View file

@ -0,0 +1,7 @@
bin/
obj/
scratch/
*.log
*.pid
*.status
*.tar.gz

19
Gjallar.sln Normal file
View file

@ -0,0 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gjallar", "src\Gjallar\Gjallar.csproj", "{5E076C9F-8FD4-4FB7-B311-99AB7F2A5034}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5E076C9F-8FD4-4FB7-B311-99AB7F2A5034}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E076C9F-8FD4-4FB7-B311-99AB7F2A5034}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E076C9F-8FD4-4FB7-B311-99AB7F2A5034}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E076C9F-8FD4-4FB7-B311-99AB7F2A5034}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 GameCult
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

142
README.md Normal file
View file

@ -0,0 +1,142 @@
# Gjallar
Gjallar is a framebuffer-native, multi-scale TUI compositor.
Most terminal UI systems assume one cell grid. Most dashboards assume a browser.
Gjallar starts from a different premise: a live machine room deserves a surface
that can subdivide pixels into weighted regions, give each region its own text
resolution, and render dense operational state without pretending every panel
should share the same font, cadence, or scale.
Call it a new kind of TUI if you want to be grandiose. We do.
## What It Is
Gjallar is a tiling window manager for semantic text surfaces:
```text
surface sources
-> weighted pane tree
-> per-pane virtual text grids
-> per-pane font and cell resolution
-> framebuffer frames today
-> sparse cell / glyph / dirty-rect pipes tomorrow
```
It is not curses, tmux, or a web dashboard. Those are useful ancestors and
neighbors, but they do not own this shape. Gjallar is built for dashboards where
one panel might need huge visible status text, another might need a tiny
high-density queue, and another might need a marquee or rapidly changing
operator signal, all on the same physical display.
## Why It Exists
The immediate body is Nightwing: a local machine with an attached framebuffer
display. The current feed comes from Odin's provider catalog. Odin discovers
what surfaces exist; Gjallar decides how to show them.
The product is broader than that first deployment:
- control-room wallboards without a browser stack;
- local appliance dashboards;
- agent and daemon operations cockpits;
- terminal-native observability surfaces;
- low-bandwidth or sparse-refresh display pipes;
- human-visible and agent-readable TUI contexts from the same composed model.
The useful abstraction is not "a dashboard." The useful abstraction is a
multi-resolution text compositor whose panes are real spatial surfaces, not
monospace boxes trapped inside one global terminal grid.
## Current Runtime
Gjallar is currently a C# executable:
```powershell
dotnet build .\src\Gjallar\Gjallar.csproj
```
Publish a self-contained Linux build:
```powershell
dotnet publish .\src\Gjallar\Gjallar.csproj -c Release -r linux-x64 --self-contained true -o .\scratch\publish\gjallar
```
Run against Odin's provider catalog:
```bash
/opt/gamecult/gjallar/Gjallar \
--fb /dev/fb0 \
--url ws://192.168.1.66:8797/eve/deck \
--refresh-hz 60 \
--stats-path /var/log/gjallar.status
```
In catalog mode, Gjallar:
1. reads `/eve/deck/providers`;
2. filters display-capable provider surfaces;
3. opens each `/eve/deck/<providerId>` stream;
4. builds an in-memory `gjallar.overview` surface;
5. packs panels into weighted pixel regions;
6. chooses a font/cell resolution for each region;
7. draws text, panels, gutters, and marquee;
8. writes one BGRA frame to the framebuffer.
## Architecture
Current internal organs:
- `GjallarConfig`: runtime flags and display source selection.
- `GjallarRenderer`: receive loop, catalog composition, frame loop, telemetry.
- `AabbPacker`: weighted region partitioning.
- `EveNode`: retained surface tree projection.
- `FrameDocument`: framebuffer drawing command surface.
- `FontAtlas` / `PsfFont`: PSF font loading plus generated smaller fonts.
- `FramebufferDevice`: Linux `/dev/fb*` mapping or file-backed framebuffer.
The next durable cut is to make the compositor model explicit:
```text
GjallarOverview
-> PaneTree
-> PaneGrid
-> RenderPlan
-> FramebufferBackend | SparseCellBackend | AgentTextBackend
```
Today some of that model is still implicit inside the renderer. That is useful
scaffolding, not a final architecture.
## Relationship To Odin
Odin sees. Gjallar shows.
Odin owns Verse discovery, provider cataloging, schemas, routes, and accepted
provider/proxy surfaces. Gjallar consumes those surfaces and owns composition,
density, tiling, font scale, update cadence, and display lowering.
If Odin decides where a panel goes on Nightwing, ownership leaked upward. If a
provider starts shaping itself for Nightwing instead of publishing a clean
surface, ownership leaked downward.
## Status
Early but live. Gjallar is already deployed on Nightwing as `gjallar.service`
and writes status telemetry such as:
```json
{
"schema": "gamecult.gjallar.frame.v1",
"receive": {
"status": "catalog-composed",
"catalogProviders": 4,
"composedProviders": 3
},
"scene": {
"panels": 3
}
}
```
The horn is not polished. It is real enough to make noise.

66
docs/architecture.md Normal file
View file

@ -0,0 +1,66 @@
# Gjallar Architecture
## Objective
Gjallar owns framebuffer-native, multi-scale TUI composition: turning many
surface inputs into one dense, inspectable operator display where different
regions may use different text resolutions.
## Authority Map
- Owner: Gjallar owns display composition, pane partitioning, per-pane virtual
text grids, font-scale selection, framebuffer lowering, and future sparse
refresh output.
- Inputs: provider catalogs, provider-owned surface trees, display dimensions,
font assets, runtime flags, and eventually direct CultMesh subscriptions.
- Outputs: `gjallar.overview` composition state, visible framebuffer frames,
and renderer telemetry.
- Derived state: pane weights, pixel rectangles, chosen font sizes, gutter
routes, dirty rectangles, glyph runs, and compact agent-readable projections.
- Forbidden writers: discovery systems do not decide Gjallar layout; providers
do not tune themselves for Nightwing; framebuffer backends do not invent
provider truth.
- Shared paths: full-frame rendering, sparse refresh, future browser previews,
and agent text capture should lower the same overview model.
- Deletion line: any code that both discovers provider truth and decides final
screen composition belongs on one side or the other. Gjallar shows; discovery
systems see.
## Current Pipeline
```text
Odin provider catalog
-> display provider selection
-> provider surface fetch
-> synthetic gjallar.overview surface
-> EveNode panel extraction
-> weighted AABB packing
-> per-panel text pressure estimate
-> PSF font selection
-> frame draw commands
-> BGRA framebuffer present
```
## Target Pipeline
```text
SurfaceSource[]
-> GjallarOverview
-> PaneTree
-> PaneGrid[]
-> RenderPlan
-> backend
```
Backends:
- `FramebufferBackend`: full BGRA frame writes, current implementation.
- `SparseCellBackend`: dirty cell/glyph/rect pipe for high-frequency remote or
terminal targets.
- `AgentTextBackend`: token-efficient navigation and panel capture for agents.
## First Product Claim
Gjallar is not a terminal multiplexer and not a dashboard theme. It is a
multi-resolution text compositor. The important gap is that each pane can become
its own virtual terminal scale while still belonging to one coherent display.

View file

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>Gjallar</AssemblyName>
<RootNamespace>Gjallar</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\CultMath\src\CultMath\CultMath.csproj" />
</ItemGroup>
</Project>

2127
src/Gjallar/Program.cs Normal file

File diff suppressed because it is too large Load diff