Add Fensalir reservoir worker state

This commit is contained in:
Meta Vens 2026-06-02 18:10:23 +01:00
commit f365b7c1dd
7 changed files with 500 additions and 8 deletions

View file

@ -83,3 +83,24 @@ mimir-fensalir-daemon|Mimir Fensalir Daemon|ws://127.0.0.1:8799/eve/deck/cultmes
The current worker mode is `surface-owner-installed`: kernel scheduling,
GPU-resident reservoir compute, and actual fused program-surface publication
belong behind this daemon next. Do not move those back into the editor.
## Worker-State Cut
`Mimir.FensalirDaemon` now also publishes
`mimir.fensalir_reservoir_worker_state.v1` beside the daemon summary state.
The worker state is the owner surface for reservoir job selection and pressure:
- capture pages enqueue reservoir jobs only when they contain accepted timing
slices;
- unusable pages are dropped with rejection reasons instead of being hidden by
the editor;
- queue depth, running jobs, completed jobs, dropped jobs, timing confidence,
accepted/rejected slice counts, and estimated GPU queue milliseconds are
persisted in CultCache;
- Eve surfaces bind worker metrics to the worker document, not to ad hoc
renderer telemetry.
The current worker still simulates cost from capture-page shape and configured
CPU/GPU share. That is intentional scaffolding: the next cut replaces the cost
model with real GPU/Faust/Fensalir kernel dispatch while preserving the same
owner and state contract.

View file

@ -43,6 +43,14 @@ CultCache, exposes `/health`, and serves JSON plus binary CultMesh
`/eve/deck/cultmesh`. The current worker mode is deliberately
`surface-owner-installed`; dense GPU kernels and fused program output belong
behind this daemon next.
It also publishes `mimir.fensalir_reservoir_worker_state.v1`, a separate
worker document for reservoir scheduling. Capture pages with accepted timing
slices become jobs; unusable pages are dropped with reasons. Queue depth,
running/completed/dropped jobs, accepted/rejected slice counts, timing
confidence, and estimated GPU queue pressure are now CultCache/Eve-visible.
The current worker uses a budget-derived cost model; real Fensalir GPU kernels
and Faust-assisted feature signals should replace that cost model without
moving ownership back into the editor.
Any path that only paints pixels is not the spatiotemporal machine, but the
editor still needs a real flat video compositor backend. The current

View file

@ -3,6 +3,8 @@ param(
[string]$CultCache = "",
[int]$Port = 8799,
[int]$PollMs = 100,
[int]$WorkerMs = 4,
[int]$MaxReservoirQueue = 120,
[double]$GpuBudget = 0.50,
[double]$CpuBudget = 0.25,
[switch]$NoBuild,
@ -50,6 +52,8 @@ $arguments = @(
"--port", $Port,
"--cultcache", $CultCache,
"--poll-ms", $PollMs,
"--worker-ms", $WorkerMs,
"--max-reservoir-queue", $MaxReservoirQueue,
"--gpu-budget", $GpuBudget.ToString([Globalization.CultureInfo]::InvariantCulture),
"--cpu-budget", $CpuBudget.ToString([Globalization.CultureInfo]::InvariantCulture)
)
@ -68,6 +72,8 @@ $process = Start-Process -FilePath "dotnet" -ArgumentList $arguments -WorkingDir
daemon = "Mimir.FensalirDaemon"
pid = $process.Id
port = $Port
workerMs = $WorkerMs
maxReservoirQueue = $MaxReservoirQueue
wellLog = $WellLog
cultCache = $CultCache
providerSpec = "mimir-fensalir-daemon|Mimir Fensalir Daemon|ws://127.0.0.1:$Port/eve/deck"

View file

@ -39,6 +39,8 @@ internal sealed record FensalirDaemonOptions(
int Port,
int PollMs,
int StatusSeconds,
int WorkerTickMs,
int MaxReservoirQueue,
double GpuBudget,
double CpuBudget,
bool FromStart,
@ -56,6 +58,8 @@ internal sealed record FensalirDaemonOptions(
Math.Clamp(ParseInt(args, "--port", 8799), 1024, 65535),
Math.Max(10, ParseInt(args, "--poll-ms", 100)),
Math.Max(1, ParseInt(args, "--status-seconds", 5)),
Math.Max(1, ParseInt(args, "--worker-ms", 4)),
Math.Max(1, ParseInt(args, "--max-reservoir-queue", 120)),
Math.Clamp(ParseDouble(args, "--gpu-budget", 0.50), 0.0, 1.0),
Math.Clamp(ParseDouble(args, "--cpu-budget", 0.25), 0.0, 1.0),
ParseBool(args, "--from-start", false),
@ -162,22 +166,30 @@ internal sealed class FensalirDaemonState : IAsyncDisposable
private readonly FensalirDaemonOptions options;
private readonly CultCache cache;
private readonly CultRecordHandle<MimirFensalirDaemonStateDocument> handle;
private readonly CultRecordHandle<MimirFensalirReservoirWorkerStateDocument> workerHandle;
private readonly WellLogTailState tail;
private readonly ReservoirWorkerState reservoirWorker;
private readonly object gate = new();
private MimirFensalirDaemonStateDocument document;
private MimirFensalirReservoirWorkerStateDocument workerDocument;
private DateTimeOffset lastStatus = DateTimeOffset.MinValue;
private FensalirDaemonState(
FensalirDaemonOptions options,
CultCache cache,
CultRecordHandle<MimirFensalirDaemonStateDocument> handle,
MimirFensalirDaemonStateDocument document)
MimirFensalirDaemonStateDocument document,
CultRecordHandle<MimirFensalirReservoirWorkerStateDocument> workerHandle,
MimirFensalirReservoirWorkerStateDocument workerDocument)
{
this.options = options;
this.cache = cache;
this.handle = handle;
this.workerHandle = workerHandle;
this.document = document;
this.workerDocument = workerDocument;
tail = new WellLogTailState(options.WellLogPath, options.FromStart);
reservoirWorker = new ReservoirWorkerState(options);
}
public MimirFensalirDaemonStateDocument Document
@ -191,6 +203,17 @@ internal sealed class FensalirDaemonState : IAsyncDisposable
}
}
public MimirFensalirReservoirWorkerStateDocument WorkerDocument
{
get
{
lock (gate)
{
return workerDocument;
}
}
}
public static async Task<FensalirDaemonState> OpenAsync(FensalirDaemonOptions options)
{
var cache = await CultCacheMessagePack.OpenAsync(options.CultCachePath, new CultCacheOpenOptions
@ -203,8 +226,12 @@ internal sealed class FensalirDaemonState : IAsyncDisposable
var existing = cache.Get<MimirFensalirDaemonStateDocument>(key);
var document = existing ?? BuildInitialDocument(options);
var handle = await cache.UpsertAsync(document, new CultRecordHandle<MimirFensalirDaemonStateDocument>(key)).ConfigureAwait(false);
var workerKey = new CultRecordKey(options.DaemonId + "-reservoir-worker");
var existingWorker = cache.Get<MimirFensalirReservoirWorkerStateDocument>(workerKey);
var workerDocument = existingWorker ?? BuildInitialWorkerDocument(options);
var workerHandle = await cache.UpsertAsync(workerDocument, new CultRecordHandle<MimirFensalirReservoirWorkerStateDocument>(workerKey)).ConfigureAwait(false);
await cache.FlushAsync().ConfigureAwait(false);
return new FensalirDaemonState(options, cache, handle, document);
return new FensalirDaemonState(options, cache, handle, document, workerHandle, workerDocument);
}
public async Task RunAsync(CancellationToken stopping)
@ -226,9 +253,21 @@ internal sealed class FensalirDaemonState : IAsyncDisposable
}
}
if (reservoirWorker.Advance(DateTimeOffset.UtcNow, out var workerSample))
{
lock (gate)
{
document = ApplyWorkerSample(document, workerSample);
workerDocument = BuildWorkerDocument(options, document, workerSample);
}
touched = true;
}
if (touched)
{
await cache.UpsertAsync(document, handle).ConfigureAwait(false);
await cache.UpsertAsync(workerDocument, workerHandle).ConfigureAwait(false);
await cache.FlushAsync(soft: true).ConfigureAwait(false);
if (options.Once)
{
@ -241,7 +280,7 @@ internal sealed class FensalirDaemonState : IAsyncDisposable
lastStatus = DateTimeOffset.UtcNow;
var state = Document;
Console.Error.WriteLine(
$"mimir-fensalir-daemon status={state.Status} wellSeq={state.LastWellSequence} captureSeq={state.LastCaptureSequence} slices={state.ReadySlices}/{state.TotalSlices} offset={tail.Position}");
$"mimir-fensalir-daemon status={state.Status} wellSeq={state.LastWellSequence} captureSeq={state.LastCaptureSequence} slices={state.ReadySlices}/{state.TotalSlices} jobs={state.PendingReservoirJobs} active={state.ActiveReservoirWorkers} done={state.CompletedReservoirJobs} drop={state.DroppedReservoirJobs} offset={tail.Position}");
}
try
@ -300,12 +339,14 @@ internal sealed class FensalirDaemonState : IAsyncDisposable
if (kind == "mimir.well_capture_page.v1")
{
var captureSequence = (long)DaemonUtil.JsonNumber(root, "captureSequence");
reservoirWorker.Enqueue(BuildReservoirJob(root, current, captureSequence));
next = current with
{
UpdatedAtUtc = DateTimeOffset.UtcNow.ToString("O"),
Status = "drinking-capture-pages",
WellSource = string.IsNullOrWhiteSpace(options.WellLogPath) ? "missing" : options.WellLogPath,
LastCaptureSequence = (long)DaemonUtil.JsonNumber(root, "captureSequence"),
LastCaptureSequence = captureSequence,
};
return true;
}
@ -347,7 +388,349 @@ internal sealed class FensalirDaemonState : IAsyncDisposable
options.CpuBudget,
"surface-owner-installed",
["cultcache-state", "cultnet-websocket", "cultmesh-eve-dashboard", "well-tail"],
["reservoir kernels pending"]);
["reservoir kernels pending"],
0,
0,
0,
0,
0.0,
0.0);
private static MimirFensalirReservoirWorkerStateDocument BuildInitialWorkerDocument(FensalirDaemonOptions options) =>
new(
options.DaemonId + "-reservoir-worker",
DateTimeOffset.UtcNow.ToString("O"),
options.DaemonId,
"surface-owner-installed",
-1,
"configuredComposite",
0,
0,
[],
options.GpuBudget,
options.CpuBudget,
0,
0,
0,
0,
0,
0,
"",
0,
string.IsNullOrWhiteSpace(options.WellLogPath) ? "waiting-for-well" : "booting",
"no capture page accepted yet",
0.0,
0.0,
0.0,
0.0,
0,
0.0);
private static MimirFensalirDaemonStateDocument ApplyWorkerSample(
MimirFensalirDaemonStateDocument current,
ReservoirWorkerSample sample)
{
var status = current.Status;
if (sample.RunningJobs > 0)
{
status = "reservoir-worker-active";
}
else if (sample.QueuedJobs > 0)
{
status = "reservoir-worker-queued";
}
return current with
{
UpdatedAtUtc = DateTimeOffset.UtcNow.ToString("O"),
Status = status,
WorkerMode = "reservoir-worker-scheduled",
PendingReservoirJobs = sample.QueuedJobs + sample.RunningJobs,
ActiveReservoirWorkers = sample.RunningJobs,
CompletedReservoirJobs = sample.CompletedJobs,
DroppedReservoirJobs = sample.DroppedJobs,
ReservoirQueueMs = sample.GpuQueueMs,
ReservoirWorkerUtilization = sample.Utilization,
};
}
private static MimirFensalirReservoirWorkerStateDocument BuildWorkerDocument(
FensalirDaemonOptions options,
MimirFensalirDaemonStateDocument current,
ReservoirWorkerSample sample) =>
new(
options.DaemonId + "-reservoir-worker",
DateTimeOffset.UtcNow.ToString("O"),
options.DaemonId,
"reservoir-worker-scheduled",
sample.InputCaptureSequence,
sample.SelectedCompositeVersion,
sample.AcceptedSlices,
sample.RejectedSlices,
sample.RejectionReasons,
options.GpuBudget,
options.CpuBudget,
sample.QueuedJobs,
sample.RunningJobs,
sample.CompletedJobs,
sample.DroppedJobs,
sample.OldestAcceptedCanonicalNs,
sample.NewestAcceptedCanonicalNs,
sample.OutputProgramSurfaceId,
sample.OutputFenceValue,
sample.Status,
sample.PressureReason,
current.PollAverageMs,
current.PublishAverageMs,
current.TotalSlices <= 0 ? 0.0 : current.ReadySlices / (double)current.TotalSlices,
sample.TimingConfidenceMin,
sample.MaxDistanceFromPresentationNs,
sample.GpuQueueMs);
private static ReservoirJob BuildReservoirJob(JsonElement root, MimirFensalirDaemonStateDocument current, long captureSequence)
{
var samples = DaemonUtil.JsonArray(DaemonUtil.JsonGet(root, "samples")).ToArray();
var frame = DaemonUtil.JsonGet(root, "frame");
var composite = DaemonUtil.JsonGet(root, "configuredComposite");
var videoComposite = DaemonUtil.JsonArray(DaemonUtil.JsonGet(composite, "video")).ToArray();
var accepted = 0;
var rejected = 0;
var oldestNs = long.MaxValue;
var newestNs = long.MinValue;
var minConfidence = 1.0;
var maxDistanceNs = 0L;
var reasons = new SortedSet<string>(StringComparer.Ordinal);
foreach (var sample in samples)
{
var slice = DaemonUtil.JsonGet(sample, "slice");
var status = DaemonUtil.JsonText(slice, "status", "Status") ?? "";
var confidence = DaemonUtil.JsonNumber(slice, "timingConfidence", "TimingConfidence");
var distanceNs = Math.Abs((long)DaemonUtil.JsonNumber(slice, "distanceFromPresentationNs", "DistanceFromPresentationNs"));
var startNs = (long)DaemonUtil.JsonNumber(slice, "canonicalStartNs", "CanonicalStartNs");
var endNs = (long)DaemonUtil.JsonNumber(slice, "canonicalEndNs", "CanonicalEndNs");
if (string.Equals(status, "Ready", StringComparison.OrdinalIgnoreCase) && confidence >= 0.20)
{
accepted++;
minConfidence = Math.Min(minConfidence, confidence);
maxDistanceNs = Math.Max(maxDistanceNs, distanceNs);
oldestNs = Math.Min(oldestNs, startNs);
newestNs = Math.Max(newestNs, endNs);
}
else
{
rejected++;
reasons.Add(string.IsNullOrWhiteSpace(status) ? "missing-status" : $"slice-{status.ToLowerInvariant()}");
if (confidence < 0.20)
{
reasons.Add("low-timing-confidence");
}
}
}
return new ReservoirJob(
captureSequence,
samples.Length,
accepted,
rejected,
oldestNs == long.MaxValue ? 0 : oldestNs,
newestNs == long.MinValue ? 0 : newestNs,
minConfidence == 1.0 && accepted == 0 ? 0.0 : minConfidence,
maxDistanceNs,
DaemonUtil.JsonNumber(frame, "presentationDelayMs", "PresentationDelayMs", "PresentationDelayMilliseconds"),
current.PollAverageMs,
current.PublishAverageMs,
videoComposite.Length == 0 ? "configuredComposite" : $"configuredComposite/video:{videoComposite.Length}",
reasons.ToArray(),
Math.Max(0, current.AudioSources),
Math.Max(0, current.VideoSources));
}
}
internal sealed class ReservoirWorkerState
{
private const double BaseSliceCostMs = 4.0;
private readonly FensalirDaemonOptions options;
private readonly Queue<ReservoirJob> queue = new();
private DateTimeOffset lastAdvanced = DateTimeOffset.UtcNow;
private ReservoirJob? active;
private double activeRemainingMs;
private long completed;
private long dropped;
private long outputFenceValue;
private ReservoirWorkerSample lastSample = ReservoirWorkerSample.Empty;
public ReservoirWorkerState(FensalirDaemonOptions options)
{
this.options = options;
}
public void Enqueue(ReservoirJob job)
{
if (job.CaptureSequence < 0 || job.AcceptedSlices <= 0)
{
dropped++;
lastSample = lastSample with
{
DroppedJobs = dropped,
Status = "dropping-unusable-capture-page",
PressureReason = job.RejectionReasons.Length == 0 ? "no accepted slices" : string.Join(",", job.RejectionReasons.Take(3)),
};
return;
}
while (queue.Count >= options.MaxReservoirQueue)
{
queue.Dequeue();
dropped++;
}
queue.Enqueue(job);
}
public bool Advance(DateTimeOffset now, out ReservoirWorkerSample sample)
{
var elapsedMs = Math.Max(0.0, (now - lastAdvanced).TotalMilliseconds);
if (elapsedMs < options.WorkerTickMs && active == null && queue.Count == 0)
{
sample = lastSample;
return false;
}
lastAdvanced = now;
var budget = WorkerBudget();
var availableMs = Math.Max(options.WorkerTickMs, elapsedMs) * budget;
var completedJob = active;
while (availableMs > 0.0)
{
if (active == null)
{
if (!queue.TryDequeue(out var next))
{
break;
}
active = next;
activeRemainingMs = Cost(next);
}
var spent = Math.Min(activeRemainingMs, availableMs);
activeRemainingMs -= spent;
availableMs -= spent;
if (activeRemainingMs <= 0.0001)
{
completedJob = active;
active = null;
activeRemainingMs = 0.0;
completed++;
outputFenceValue++;
}
}
sample = BuildSample(completedJob);
lastSample = sample;
return true;
}
private ReservoirWorkerSample BuildSample(ReservoirJob? latest)
{
var job = active ?? latest ?? queue.LastOrDefault();
var queueMs = (activeRemainingMs + queue.Sum(Cost)) / Math.Max(0.05, WorkerBudget());
var running = active == null ? 0 : 1;
var status = running > 0 ? "running" : queue.Count > 0 ? "queued" : completed > 0 ? "caught-up" : lastSample.Status;
var reason = queue.Count >= options.MaxReservoirQueue ? "queue at ceiling" : "within configured worker budget";
return new ReservoirWorkerSample(
job?.CaptureSequence ?? lastSample.InputCaptureSequence,
job?.SelectedCompositeVersion ?? lastSample.SelectedCompositeVersion,
job?.AcceptedSlices ?? 0,
job?.RejectedSlices ?? 0,
job?.RejectionReasons ?? [],
queue.Count,
running,
completed,
dropped,
job?.OldestAcceptedCanonicalNs ?? 0,
job?.NewestAcceptedCanonicalNs ?? 0,
"mimir.fensalir.program.surface.pending",
outputFenceValue,
status,
reason,
job?.TimingConfidenceMin ?? 0.0,
job?.MaxDistanceFromPresentationNs ?? 0,
queueMs,
running > 0 ? WorkerBudget() : 0.0);
}
private double WorkerBudget() => Math.Clamp(options.GpuBudget * 0.70 + options.CpuBudget * 0.30, 0.05, 1.0);
private static double Cost(ReservoirJob job)
{
var sliceCost = Math.Max(1, job.AcceptedSlices) * BaseSliceCostMs;
var rejectedPenalty = Math.Max(0, job.RejectedSlices) * 0.25;
var videoCost = Math.Max(0, job.VideoSources) * 2.0;
var audioCost = Math.Max(0, job.AudioSources) * 0.5;
var pressureCost = Math.Max(job.WellPollMs, job.WellPublishMs) * 0.10;
return Math.Max(1.0, sliceCost + rejectedPenalty + videoCost + audioCost + pressureCost);
}
}
internal sealed record ReservoirJob(
long CaptureSequence,
int TotalSlices,
int AcceptedSlices,
int RejectedSlices,
long OldestAcceptedCanonicalNs,
long NewestAcceptedCanonicalNs,
double TimingConfidenceMin,
long MaxDistanceFromPresentationNs,
double PresentationDelayMs,
double WellPollMs,
double WellPublishMs,
string SelectedCompositeVersion,
string[] RejectionReasons,
int AudioSources,
int VideoSources);
internal sealed record ReservoirWorkerSample(
long InputCaptureSequence,
string SelectedCompositeVersion,
int AcceptedSlices,
int RejectedSlices,
string[] RejectionReasons,
int QueuedJobs,
int RunningJobs,
long CompletedJobs,
long DroppedJobs,
long OldestAcceptedCanonicalNs,
long NewestAcceptedCanonicalNs,
string OutputProgramSurfaceId,
long OutputFenceValue,
string Status,
string PressureReason,
double TimingConfidenceMin,
long MaxDistanceFromPresentationNs,
double GpuQueueMs,
double Utilization)
{
public static ReservoirWorkerSample Empty { get; } = new(
-1,
"configuredComposite",
0,
0,
[],
0,
0,
0,
0,
0,
0,
"",
0,
"waiting",
"no capture page accepted yet",
0.0,
0,
0.0,
0.0);
}
internal sealed class FensalirDaemonEveServer(FensalirDaemonOptions options, FensalirDaemonState state) : IDisposable
@ -391,8 +774,14 @@ internal sealed class FensalirDaemonEveServer(FensalirDaemonOptions options, Fen
providerId = options.DaemonId,
verse = options.VerseId,
status = state.Document.Status,
workerStatus = state.WorkerDocument.Status,
queuedJobs = state.WorkerDocument.QueuedJobs,
runningJobs = state.WorkerDocument.RunningJobs,
completedJobs = state.WorkerDocument.CompletedJobs,
droppedJobs = state.WorkerDocument.DroppedJobs,
cultCache = options.CultCachePath,
cultMeshDocument = "mimir.fensalir_daemon_state",
workerDocument = "mimir.fensalir_reservoir_worker_state",
}, JsonOptions);
await DaemonUtil.WriteHttpResponseAsync(stream, "200 OK", "application/json", Encoding.UTF8.GetBytes(health)).ConfigureAwait(false);
return;
@ -421,7 +810,8 @@ internal sealed class FensalirDaemonEveServer(FensalirDaemonOptions options, Fen
private async Task SendStateAsync(NetworkStream stream, bool binary)
{
var document = state.Document;
var dashboard = BuildDashboard(document);
var worker = state.WorkerDocument;
var dashboard = BuildDashboard(document, worker);
if (binary)
{
var cultMesh = ToCultMesh(dashboard);
@ -432,16 +822,18 @@ internal sealed class FensalirDaemonEveServer(FensalirDaemonOptions options, Fen
await DaemonUtil.SendTextFrameAsync(stream, JsonSerializer.Serialize(dashboard, JsonOptions)).ConfigureAwait(false);
}
private DashboardState BuildDashboard(MimirFensalirDaemonStateDocument doc)
private DashboardState BuildDashboard(MimirFensalirDaemonStateDocument doc, MimirFensalirReservoirWorkerStateDocument worker)
{
var readiness = doc.TotalSlices <= 0 ? 0.0 : doc.ReadySlices / (double)doc.TotalSlices;
var pressure = Math.Clamp(Math.Max(doc.PollAverageMs / 16.0, doc.PublishAverageMs / 16.0), 0.0, 1.0);
var workerPressure = Math.Clamp(worker.GpuQueueMs / 1000.0, 0.0, 1.0);
var nodes = new List<DashboardNode>
{
new("daemon", $"Fensalir Daemon\n{doc.Status}", "daemon", 0.0, -0.42, 0.70, 0.18, doc.Status),
new("well", $"Well Drink\nseq {doc.LastWellSequence}", "well", -0.38, -0.08, 0.32, 0.18, doc.LastWellSequence >= 0 ? "live" : "waiting"),
new("capture", $"Capture Pages\nseq {doc.LastCaptureSequence}", "cultcache", 0.0, -0.08, 0.32, 0.18, doc.LastCaptureSequence >= 0 ? "paged" : "waiting"),
new("budget", $"Budget\nGPU {doc.GpuBudget:0.00} CPU {doc.CpuBudget:0.00}", "budget", 0.38, -0.08, 0.32, 0.18, "configured"),
new("worker", $"Reservoir Worker\n{worker.Status}", "worker", 0.0, 0.26, 0.54, 0.18, worker.Status),
};
return new DashboardState
{
@ -473,6 +865,16 @@ internal sealed class FensalirDaemonEveServer(FensalirDaemonOptions options, Fen
Ui.Text("well-counts", $"audio {doc.AudioSources} video {doc.VideoSources} delay {doc.PresentationDelayMs:0.0}ms", "caption", Bind("/presentationDelayMs")),
]),
]),
Ui.Row("daemon-row-worker",
[
Ui.Pane("worker-pane", "Reservoir Worker",
[
Ui.Text("worker-status", $"{worker.Status} | {worker.PressureReason}", "strong", WorkerBind("/status")),
Ui.Text("worker-counts", $"queued {worker.QueuedJobs} running {worker.RunningJobs} completed {worker.CompletedJobs} dropped {worker.DroppedJobs}", "mono", WorkerBind("/queuedJobs")),
Ui.Text("worker-slices", $"accepted {worker.AcceptedSlices} rejected {worker.RejectedSlices} confidence {worker.TimingConfidenceMin:0.000}", "caption", WorkerBind("/acceptedSlices")),
Ui.Bar("worker-queue", "GPU queue", workerPressure, DaemonUtil.Tone(1.0 - workerPressure), $"{worker.GpuQueueMs:0.0}ms"),
]),
]),
Ui.Row("daemon-row-bottom",
[
Ui.Pane("budget-pane", "Budgets",
@ -503,6 +905,16 @@ internal sealed class FensalirDaemonEveServer(FensalirDaemonOptions options, Fen
Authority = "Mimir.FensalirDaemon",
};
private UiBinding WorkerBind(string path) => new()
{
DocumentSchema = "mimir.fensalir_reservoir_worker_state.v1",
DocumentId = options.DaemonId + "-reservoir-worker",
Path = path,
ValueKind = "state",
Access = "read",
Authority = "Mimir.FensalirDaemon",
};
private static MimirEveDashboardStateDocument ToCultMesh(DashboardState state) =>
new(
state.ProviderId,

View file

@ -127,7 +127,46 @@ public sealed record MimirFensalirDaemonStateDocument(
[property: Key(15)] double CpuBudget,
[property: Key(16)] string WorkerMode,
[property: Key(17)] string[] Capabilities,
[property: Key(18)] string[] Notes);
[property: Key(18)] string[] Notes,
[property: Key(19)] int PendingReservoirJobs,
[property: Key(20)] int ActiveReservoirWorkers,
[property: Key(21)] long CompletedReservoirJobs,
[property: Key(22)] long DroppedReservoirJobs,
[property: Key(23)] double ReservoirQueueMs,
[property: Key(24)] double ReservoirWorkerUtilization);
[CultDocument("mimir.fensalir_reservoir_worker_state", "mimir.fensalir_reservoir_worker_state.v1")]
[MessagePackObject]
public sealed record MimirFensalirReservoirWorkerStateDocument(
[property: Key(0)]
[property: CultName]
string WorkerId,
[property: Key(1)] string UpdatedAtUtc,
[property: Key(2)] string DaemonId,
[property: Key(3)] string WorkerMode,
[property: Key(4)] long InputCaptureSequence,
[property: Key(5)] string SelectedCompositeVersion,
[property: Key(6)] int AcceptedSlices,
[property: Key(7)] int RejectedSlices,
[property: Key(8)] string[] RejectionReasons,
[property: Key(9)] double GpuBudget,
[property: Key(10)] double CpuBudget,
[property: Key(11)] int QueuedJobs,
[property: Key(12)] int RunningJobs,
[property: Key(13)] long CompletedJobs,
[property: Key(14)] long DroppedJobs,
[property: Key(15)] long OldestAcceptedCanonicalNs,
[property: Key(16)] long NewestAcceptedCanonicalNs,
[property: Key(17)] string OutputProgramSurfaceId,
[property: Key(18)] long OutputFenceValue,
[property: Key(19)] string Status,
[property: Key(20)] string PressureReason,
[property: Key(21)] double WellPollMs,
[property: Key(22)] double WellPublishMs,
[property: Key(23)] double ReadySliceRatio,
[property: Key(24)] double TimingConfidenceMin,
[property: Key(25)] long MaxDistanceFromPresentationNs,
[property: Key(26)] double GpuQueueMs);
[CultDocument("mimir.eve_dashboard_manifest", "mimir.eve_dashboard_manifest.v1")]
[MessagePackObject]

View file

@ -360,3 +360,4 @@
{"ts": "2026-06-02T16:14:03+01:00", "type": "implementation", "status": "ok", "note": "Added Mimir.WellObsDaemon and scripts/start-well-obs-daemon.ps1. The daemon tails Well capture pages with inline audio bodies, applies configuredComposite audio mute/solo/gain selection, publishes well_composite plus per-source well_<source> stems into the existing Local\\\\MimirObsStemBus OBS plugin ABI, and refuses metadata-only bodies. Smoke fixture published well_composite/well_asio_ch0/well_asio_ch1 into a test map with expected Float32 samples; launcher smoke recorded real daemon PID and supervisor manifest."}
{"ts": "2026-06-02T17:22:39+01:00", "type": "implementation", "status": "ok", "note": "2026-06-02: Mimir editor responsiveness scar/fix. Fensalir reservoir history is now gated by source-derived reservoir-producing inputs instead of running on every scene presentation. Live video-only editor run artifacts/runtime/program-texture-video-only-fast-20260602-172059 showed reservoir-update n/a and CPU frame about 8-9 ms. Remaining gap is architectural: FieldEvidenceFrame camera Texture2D declarations are not a flat video compositor backend, so live synced camera feeds need an explicit Fensalir 2D program-layer draw path or a separate Fensalir reservoir daemon output surface."}
{"ts": "2026-06-02T17:38:35+01:00", "type": "implementation", "status": "ok", "note": "2026-06-02: Added Mimir.FensalirDaemon as the first Well-drinking Fensalir reservoir owner surface. It tails Well JSONL documents, persists mimir.fensalir_daemon_state.v1 in state/fensalir-daemon.ccmp via CultCache MessagePack, serves /health and /eve/deck/manifest, and publishes Eve dashboard state over JSON WebSocket plus binary CultMesh mimir.eve_dashboard_state.v1 at /eve/deck/cultmesh. Smoke run fensalir-daemon-20260602-173556 reported health status=drinking-capture-pages and binary provider=mimir-fensalir-daemon nodes=4 surface=mimir.fensalir-daemon.surface. Current workerMode is surface-owner-installed; dense GPU kernels and fused program output still belong behind this daemon."}
{"ts": "2026-06-02T18:09:09+01:00", "type": "implementation", "status": "ok", "note": "2026-06-02: Extended Mimir.FensalirDaemon from surface owner to reservoir scheduler owner. Added mimir.fensalir_reservoir_worker_state.v1 plus daemon summary worker counters, queue/running/completed/dropped job telemetry, accepted/rejected capture slice accounting, timing-confidence and GPU-queue pressure. Verified isolated daemon build succeeded and disposable fixture capture page completed one reservoir job with droppedJobs=0 while an empty smoke capture page was dropped as unusable."}

View file

@ -62,6 +62,11 @@ invariants:
binary CultMesh Eve dashboard state on port 8799. Its current
`workerMode=surface-owner-installed` means dense kernels and fused program
output are still pending behind the daemon, not silently owned elsewhere.
It also publishes `mimir.fensalir_reservoir_worker_state.v1` for scheduler
ownership: accepted/rejected capture slices, queue/running/completed/dropped
jobs, timing confidence, and estimated GPU queue pressure. The editor may
observe these values but must not repair, schedule, or publish reservoir
work.
- `FieldEvidenceFrame` is not a flat video compositor. Camera Texture2D
resources and claims are typed evidence declarations; they do not draw live
Fensalir-owned texture leases as 2D program layers until Fensalir has an