diff --git a/README.md b/README.md
index 1555460..de09f01 100644
--- a/README.md
+++ b/README.md
@@ -19,8 +19,8 @@ The first Rust core lives in `crates/odin-core` and already separates typed
documents, ingest ports, normalization, and repository persistence so unit tests
can use mocked inputs and pipeline smokes can prove typed handoff without
booting the whole daemon. Gjallar is not part of that Rust record spine: it is
-the Nightwing-resident terminal compositor that consumes Odin's published
-Eve/CultUI deck and renders the live display.
+the Nightwing-resident terminal compositor in `E:\Projects\Gjallar` that
+consumes Odin's published Eve/CultUI deck and renders the live display.
## Gjallar
@@ -34,7 +34,7 @@ Local package surfaces:
- Organ contract: `docs/gjallar.md`
- Branding Persona state: `personas/gjallar.persona_state.cc`
-- Runtime source: `src/Gjallar`
+- Runtime source: `E:\Projects\Gjallar`
- Avatar asset: `assets/personas/gjallar-avatar.png`
- Pixel avatar: `assets/personas/gjallar-avatar-pixel-256.png`
diff --git a/docs/architecture.md b/docs/architecture.md
index cb31251..104d125 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -74,7 +74,8 @@ Odin's executable body is split by ownership:
The entrypoint is not allowed to grow new probe, surface, provider, layout, or renderer policy. If a new owner is needed, name the owner and its invariant before adding code.
Gjallar is the Nightwing-resident terminal compositor for what Odin can show.
-Its runtime lives in `src/Gjallar` and consumes Odin's Eve deck directly.
+Its runtime lives in `E:\Projects\Gjallar` and consumes Odin's Eve deck
+directly.
Gjallar owns provider enumeration for display, panel packing, marquee behavior,
glyph/color/framebuffer lowering, frame stats, and the multi-scale terminal
product. It must not own the underlying registry, probe, provider truth, or
diff --git a/docs/gjallar.md b/docs/gjallar.md
index 35e6625..2815f2f 100644
--- a/docs/gjallar.md
+++ b/docs/gjallar.md
@@ -29,12 +29,12 @@ body they are being lowered into.
overlays, and agent-facing TUI captures should all lower the same Gjallar
composition behavior when they want the "everything Odin can show" view.
- Deletion line: the old Rust `gjallar.overview` feed is not a runtime
- authority. Any path that wants Nightwing composition belongs in `src/Gjallar`;
- any path that decides discovery truth belongs in Odin.
+ authority. Any path that wants Nightwing composition belongs in
+ `E:\Projects\Gjallar`; any path that decides discovery truth belongs in Odin.
## Body
-- `src/Gjallar` is Gjallar's executable C# runtime.
+- `E:\Projects\Gjallar` is Gjallar's executable C# runtime repo.
- `Gjallar.csproj` builds the Nightwing framebuffer compositor.
- Gjallar consumes Odin's provider catalog over HTTP/WebSocket, defaulting to
`ws://192.168.1.66:8797/eve/deck` with no fixed provider id.
@@ -48,13 +48,13 @@ body they are being lowered into.
Build from the repo root:
```powershell
-dotnet build .\src\Gjallar\Gjallar.csproj
+dotnet build E:\Projects\Gjallar\src\Gjallar\Gjallar.csproj
```
Publish for Nightwing:
```powershell
-dotnet publish .\src\Gjallar\Gjallar.csproj -c Release -r linux-x64 --self-contained true -o .\scratch\publish\gjallar
+dotnet publish E:\Projects\Gjallar\src\Gjallar\Gjallar.csproj -c Release -r linux-x64 --self-contained true -o E:\Projects\Gjallar\scratch\publish\gjallar
```
## Runtime Contract
diff --git a/src/Gjallar/Gjallar.csproj b/src/Gjallar/Gjallar.csproj
deleted file mode 100644
index 830da2d..0000000
--- a/src/Gjallar/Gjallar.csproj
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- Exe
- net10.0
- enable
- enable
- true
- Gjallar
- Gjallar
-
-
-
-
-
diff --git a/src/Gjallar/Program.cs b/src/Gjallar/Program.cs
deleted file mode 100644
index e89a225..0000000
--- a/src/Gjallar/Program.cs
+++ /dev/null
@@ -1,2127 +0,0 @@
-using System.Buffers;
-using System.Diagnostics;
-using System.Globalization;
-using System.IO.Compression;
-using System.Net.WebSockets;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Text.Json;
-using CultMath;
-
-var config = GjallarConfig.Parse(args);
-using var renderer = new GjallarRenderer(config);
-await renderer.RunAsync();
-
-internal sealed record GjallarConfig(
- string FramebufferPath,
- string Url,
- string ProviderId,
- int RefreshHz,
- int CatalogRefreshSeconds,
- string StatusPath,
- string FrameDumpPath,
- int Frames,
- int Width,
- int Height,
- string FontPath)
-{
- public static GjallarConfig Parse(IReadOnlyList args) => new(
- StringArg(args, "--fb", "/dev/fb0"),
- StringArg(args, "--url", "ws://192.168.1.66:8797/eve/deck"),
- StringArg(args, "--provider", ""),
- IntArg(args, "--refresh-hz", 2),
- IntArg(args, "--catalog-refresh-seconds", 5),
- StringArg(args, "--stats-path", "/var/log/gjallar.status"),
- StringArg(args, "--frame-dump-path", ""),
- IntArg(args, "--frames", 0),
- IntArg(args, "--width", 0),
- IntArg(args, "--height", 0),
- StringArg(args, "--font", ""));
-
- private static string StringArg(IReadOnlyList args, string name, string fallback)
- {
- for (var i = 0; i < args.Count - 1; i++)
- {
- if (string.Equals(args[i], name, StringComparison.OrdinalIgnoreCase))
- {
- return args[i + 1];
- }
- }
-
- return fallback;
- }
-
- private static int IntArg(IReadOnlyList args, string name, int fallback) =>
- int.TryParse(StringArg(args, name, ""), NumberStyles.Integer, CultureInfo.InvariantCulture, out var value) ? value : fallback;
-}
-
-internal sealed class GjallarRenderer : IDisposable
-{
- private static readonly JsonSerializerOptions StatusJson = new() { WriteIndented = true };
- private static readonly JsonSerializerOptions JsonOptions = new() { PropertyNameCaseInsensitive = true };
- private readonly GjallarConfig config;
- private readonly FramebufferDevice framebuffer;
- private readonly FontAtlas fonts;
- private readonly CancellationTokenSource stopping = new();
- private readonly PeriodicTimer timer;
- private readonly TimeSpan frameInterval;
- private byte[]? latestStateJson;
- private int frameIndex;
- private long lastStatusTick;
- private int lastStatusFrame;
- private int latestCatalogProviders;
- private int latestComposedProviders;
- private string lastReceiveStatus = "starting";
- private string lastReceiveError = "";
- private SceneCache? sceneCache;
- private FrameTimings lastTimings;
-
- public GjallarRenderer(GjallarConfig config)
- {
- this.config = config;
- framebuffer = FramebufferDevice.Open(config.FramebufferPath, config.Width, config.Height);
- fonts = FontAtlas.Load(config.FontPath);
- frameInterval = TimeSpan.FromSeconds(1.0 / Math.Max(1, config.RefreshHz));
- timer = new PeriodicTimer(frameInterval);
- lastStatusTick = Stopwatch.GetTimestamp();
- }
-
- public async Task RunAsync()
- {
- var receiveTask = Task.Run(() => ConnectReceiveLoopAsync(stopping.Token));
- var rendered = 0;
- while (config.Frames <= 0 || rendered < config.Frames)
- {
- var started = DateTimeOffset.UtcNow;
- var frameStarted = Stopwatch.GetTimestamp();
- lastTimings = RenderOnce();
- rendered++;
- var paintMs = ElapsedMilliseconds(frameStarted, Stopwatch.GetTimestamp());
- WriteStatusIfDue("rendered", rendered, paintMs, lastTimings, started);
- if (!string.IsNullOrWhiteSpace(config.FrameDumpPath))
- {
- framebuffer.WritePpm(config.FrameDumpPath);
- }
-
- if (config.Frames > 0 && rendered >= config.Frames)
- {
- break;
- }
-
- await timer.WaitForNextTickAsync(stopping.Token).ConfigureAwait(false);
- }
-
- stopping.Cancel();
- try
- {
- await receiveTask.ConfigureAwait(false);
- }
- catch (OperationCanceledException) when (stopping.IsCancellationRequested)
- {
- }
- }
-
- private static Uri ProviderUri(string url, string providerId)
- {
- if (string.IsNullOrWhiteSpace(providerId))
- {
- return new Uri(url);
- }
-
- var trimmed = url.TrimEnd('/');
- if (trimmed.EndsWith("/" + providerId, StringComparison.Ordinal))
- {
- return new Uri(trimmed);
- }
-
- return new Uri($"{trimmed}/{Uri.EscapeDataString(providerId)}");
- }
-
- private async Task ConnectReceiveLoopAsync(CancellationToken token)
- {
- if (string.IsNullOrWhiteSpace(config.ProviderId))
- {
- await ConnectCatalogReceiveLoopAsync(token).ConfigureAwait(false);
- return;
- }
-
- var target = ProviderUri(config.Url, config.ProviderId);
- while (!token.IsCancellationRequested)
- {
- try
- {
- using var socket = new ClientWebSocket();
- await socket.ConnectAsync(target, token).ConfigureAwait(false);
- lastReceiveStatus = $"connected:{config.ProviderId}";
- lastReceiveError = "";
- await ReceiveLoopAsync(socket, token).ConfigureAwait(false);
- }
- catch (OperationCanceledException) when (token.IsCancellationRequested)
- {
- return;
- }
- catch (Exception error) when (!token.IsCancellationRequested)
- {
- lastReceiveStatus = $"connect-error:{config.ProviderId}";
- lastReceiveError = error.Message;
- await Task.Delay(TimeSpan.FromSeconds(2), token).ConfigureAwait(false);
- }
- }
- }
-
- private async Task ConnectCatalogReceiveLoopAsync(CancellationToken token)
- {
- while (!token.IsCancellationRequested)
- {
- try
- {
- var catalog = await ReadProviderCatalogAsync(token).ConfigureAwait(false);
- latestCatalogProviders = catalog.Providers.Count;
- var states = new List();
- foreach (var provider in catalog.Providers.Where(IsDisplayProvider))
- {
- var frame = await TryFetchProviderFrameAsync(provider, token).ConfigureAwait(false);
- if (frame != null)
- {
- states.Add(frame);
- }
- }
-
- Interlocked.Exchange(ref latestStateJson, BuildGjallarSurface(catalog, states));
- latestComposedProviders = states.Count;
- lastReceiveStatus = "catalog-composed";
- lastReceiveError = "";
- }
- catch (Exception error) when (!token.IsCancellationRequested)
- {
- lastReceiveStatus = "catalog-error";
- lastReceiveError = error.Message;
- // A missed catalog pass should make the display stale, not kill the horn.
- }
-
- await Task.Delay(TimeSpan.FromSeconds(Math.Max(1, config.CatalogRefreshSeconds)), token).ConfigureAwait(false);
- }
- }
-
- private async Task ReadProviderCatalogAsync(CancellationToken token)
- {
- using var client = new HttpClient { Timeout = TimeSpan.FromSeconds(5) };
- var json = await client.GetStringAsync(ProviderCatalogUri(), token).ConfigureAwait(false);
- return JsonSerializer.Deserialize(json, JsonOptions) ?? new ProviderCatalog([]);
- }
-
- private static bool IsDisplayProvider(ProviderCatalogEntry provider) =>
- !string.IsNullOrWhiteSpace(provider.Id) &&
- ((provider.Capabilities?.Any(static capability => string.Equals(capability, "cultui-surface", StringComparison.OrdinalIgnoreCase)) ?? false) ||
- string.Equals(provider.Endpoint, $"/eve/deck/{Uri.EscapeDataString(provider.Id)}", StringComparison.OrdinalIgnoreCase) ||
- string.Equals(provider.TransportEndpoint, $"/eve/deck/{Uri.EscapeDataString(provider.Id)}", StringComparison.OrdinalIgnoreCase));
-
- private Uri ProviderCatalogUri()
- {
- var uri = new Uri(config.Url.Replace("ws://", "http://", StringComparison.OrdinalIgnoreCase).Replace("wss://", "https://", StringComparison.OrdinalIgnoreCase));
- var builder = new UriBuilder(uri)
- {
- Path = "/eve/deck/providers",
- Query = "",
- };
- return builder.Uri;
- }
-
- private async Task TryFetchProviderFrameAsync(ProviderCatalogEntry provider, CancellationToken token)
- {
- try
- {
- using var socket = new ClientWebSocket();
- await socket.ConnectAsync(ProviderDeckUri(provider), token).ConfigureAwait(false);
- var bytes = await ReadTextFrameAsync(socket, token).ConfigureAwait(false);
- using var state = JsonDocument.Parse(bytes);
- if (!state.RootElement.TryGetProperty("surface", out var surface) ||
- !surface.TryGetProperty("root", out var root))
- {
- return null;
- }
-
- return new ProviderFrame(provider, state.RootElement.Clone(), root.Clone());
- }
- catch when (!token.IsCancellationRequested)
- {
- return ProviderFrame.Unavailable(provider);
- }
- }
-
- private Uri ProviderDeckUri(ProviderCatalogEntry provider)
- {
- var endpoint = !string.IsNullOrWhiteSpace(provider.TransportEndpoint)
- ? provider.TransportEndpoint
- : provider.Endpoint;
- if (string.IsNullOrWhiteSpace(endpoint))
- {
- endpoint = $"/eve/deck/{Uri.EscapeDataString(provider.Id)}";
- }
-
- if (Uri.TryCreate(endpoint, UriKind.Absolute, out var absolute))
- {
- return absolute.Scheme is "http" or "https"
- ? new Uri(endpoint.Replace("http://", "ws://", StringComparison.OrdinalIgnoreCase).Replace("https://", "wss://", StringComparison.OrdinalIgnoreCase))
- : absolute;
- }
-
- var baseUri = new Uri(config.Url);
- var builder = new UriBuilder(baseUri)
- {
- Path = endpoint.StartsWith("/", StringComparison.Ordinal) ? endpoint : $"/{endpoint}",
- Query = "",
- };
- return builder.Uri;
- }
-
- private static async Task ReadTextFrameAsync(ClientWebSocket socket, CancellationToken token)
- {
- var buffer = ArrayPool.Shared.Rent(1024 * 1024);
- try
- {
- using var body = new MemoryStream();
- WebSocketReceiveResult result;
- do
- {
- result = await socket.ReceiveAsync(buffer, token).ConfigureAwait(false);
- if (result.MessageType == WebSocketMessageType.Close)
- {
- return [];
- }
-
- body.Write(buffer, 0, result.Count);
- }
- while (!result.EndOfMessage);
-
- return result.MessageType == WebSocketMessageType.Text ? body.ToArray() : [];
- }
- finally
- {
- ArrayPool.Shared.Return(buffer);
- }
- }
-
- private static byte[] BuildGjallarSurface(ProviderCatalog catalog, IReadOnlyList frames)
- {
- var children = frames.Select(frame => new
- {
- id = $"gjallar-interface-{StableId(frame.Provider.Id)}",
- kind = "interface",
- props = new
- {
- title = frame.Provider.Title ?? frame.Provider.Id,
- providerId = frame.Provider.Id,
- status = frame.Provider.Status ?? "unknown",
- source = frame.Provider.Endpoint ?? "",
- updatedAt = frame.State.TryGetProperty("updatedAt", out var updatedAt) ? ValueString(updatedAt) : "",
- layout = new
- {
- density = "dense",
- viewportMode = "nested-scroll",
- },
- },
- children = new[] { frame.Root },
- }).ToArray();
-
- var document = new
- {
- type = "dashboard-state",
- schema = "gamecult.gjallar.overview.v1",
- providerId = "gjallar.overview",
- title = "Gjallar",
- version = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
- updatedAt = DateTimeOffset.UtcNow.ToString("O", CultureInfo.InvariantCulture),
- providerCatalog = catalog.Providers,
- surface = new
- {
- schema = "gamecult.eve.surface.v1",
- id = "gjallar.overview.surface",
- title = "Gjallar",
- root = new
- {
- id = "gjallar-overview-root",
- kind = "dashboard",
- props = new
- {
- title = "Gjallar",
- summary = $"{frames.Count} provider surfaces",
- marqueeText = MarqueeText(frames),
- },
- children,
- },
- assets = Array.Empty