luvcraft/agent/hud.lisp
--------------------------------------------------------------------- Tool identity: one colour per command, the way the stylesheet had one template pair per tool name.
The colour that identifies command's cassettes.
--------------------------------------------------------------------- Wrapping
text as lines of at most columns characters, broken on spaces.
--------------------------------------------------------------------- The cassette view.
Each presentation method draws from the stream's cursor row downward and
leaves the cursor below what it drew, so a sequence of present calls
stacks cards the way a stylesheet stacks templates.
They are invoked with FUNCALL-PRESENTATION-GENERIC-FUNCTION rather than
present: drawing inside WITH-OUTPUT-AS-PRESENTATION reaches the GPU
medium as a replayed output record, and nothing shows. Until the HUD
wants clickable presentations, the methods are called as plain drawing.
Draw lines from top, one per line height; return the bottom.
The spine glyph and its ink for call's status.
The lines a cassette's window shows for call: the output, folded to
*CASSETTE-OUTPUT-LINES* with a count of what is left.
The card.
The spine.
Name, arguments, clock.
The window.
Prompt.
Thought bubble, as text for now.
Calls, oldest first.
What it said.
--------------------------------------------------------------------- The frame and the overlay
Everything the HUD shows, as a key: repaint when it changes.
Return the HUD's ordinary margin below application-level top surfaces.
Top right corner, at its own size.
One pane pixel is one screen pixel unless the viewport cannot hold it: shrinking the pane shrinks its type, and small type is what reads as soft.
A HUD, not a thing in the world: never targeted, never focused.
--------------------------------------------------------------------- Opening and closing
Attach the cassette HUD for agent to its session.
Characters per wrapped line at the body text size.
(call)(text columns)A run of prose; CHILDREN are inline objects.
Test whether one compatible scalar is greater than another.
Logical conjunction of tests and raw truth values.
Addition over compatible quantities.
(queue swapchain image-index
&key (wait-semaphores #()) present-id present-stage time-domain-id
target-time target-time-domain-present-stage)(stream)(stream)Subtraction or unary negation.
(stream)(stream bottom)(stream lines top &key (ink *hud-output-ink*)
(indent 0) (size *cassette-text-size*)
(face :roman))(call)(call &optional (columns (- *agent-hud-columns* 2)))The lines a cassette's window shows for CALL: the output, folded to *CASSETTE-OUTPUT-LINES* with a count of what is left.
(call &optional (columns (- *agent-hud-columns* 2)))Multiplication and scalar scaling.
Headings, paragraphs, figures and their IDs, mentions, marks.
The rich retained view used by an agent transcript UI.
(call)((medium luv-gpu-medium) string &key text-style (start 0) end)The maximum of compatible quantities.
(frame)An explicitly owned AVFrame.
(frame)(turn)((pane lobby-hud-pane) region)(frame)A direct GPU target for an ordered LUV-GPU-MEDIUM drawing stream. An embedded mirror retains an immutable prepared CPU revision for the game's final pass; a standalone mirror renders into its native canvas drawable.
A direct McCLIM surface mounted in the presentation HUD.
(overlay)Return where OVERLAY draws: :SCENE, :WORLD-PANEL, :VIEWMODEL, :HUD, or :NONE. Scene overlays inhabit world depth; viewmodels are first-person geometry above the world but below held items and the crosshair. World panels retain world projection and depth while drawing analytic application graphics at native…
(session)(session)(overlay)Top right corner, at its own size. One pane pixel is one screen pixel unless the viewport cannot hold it: shrinking the pane shrinks its type, and small type is what reads as soft.
(overlay)The minimum of compatible quantities.
Division of two represented quantities.
(overlay session pass surface-texture)Encode OVERLAY into SESSION's open scene PASS for SURFACE-TEXTURE.
(overlay session)Publish any complete pending render state for OVERLAY at a frame boundary.
(focus session)Return a non-negative targeting score when FOCUS can be entered by TAB.
(session)(&key (agent (or *agent* (make-world-agent)))
(session (world-agent-session agent)))Logical disjunction of tests and raw truth values.
The most recently made Luvcraft WORLD-AGENT for REPL convenience.
(&key (session luvcraft:*session*)
(model *default-agent-model*)
(commands *default-agent-tools*)
(instructions *default-instructions*)
(reasoning-summary "auto")
reasoning-effort
(api-key (openai:default-api-key)))Open Luvcraft's thin WORLD-AGENT specialization for SESSION. Connection setup performs network I/O; call this from SLY or a setup worker, never from the canvas thread. Once open, ASK itself always returns at once.
(agent)A McCLIM frame manager constrained by luv's current native host.
(session overlay)Attach OVERLAY at SESSION's next native frame boundary and return it. ADD consumes a newly offered OVERLAY on both success and terminal rejection. Once SESSION begins stopping, the rejected overlay is released exactly once before APPLICATION-ATTACHMENT-CLOSED is signalled.
(&key (session (and *agent* (world-agent-session *agent*))))(session overlay &key (release-p t))Detach OVERLAY at a frame boundary and optionally release it there. The no-release path is intentionally preserved for FUSE-LUVCRAFT-OVERLAY: that path may run inside a frame whose command stream still borrows OVERLAY.
(&key (agent (or *agent* (make-world-agent))))Before nxt deleted its UI runtime (nxtui commit 3d692d0), a tool call was drawn as a cassette (#7FFNVT): a trace as XML (turn > thought | call[name, status, elapsed] > args, result[kind], affordances[key]), and one XSLT stylesheet, cassette/baltic-birch-v1.xsl, holding the whole visual language in about three hundred…
The same nxtui tree (src/nxtrt/ui_runtime.hpp, src/nxtai/tool_ui.cpp) drew a batch of parallel tool calls with two verbs: draw(layout) replaces a live surface shown as a bottom HUD, and print(layout) commits a rendered block to durable scrollback above it. Each tool call was a child with its own slot; the batch drew…
The cassette HUD: the current turn drawn as cards in the corner (#9K823O, #14ZP6S).
A McCLIM frame composited over the view, the way the hotbar and the legend are. Every frame the overlay reads the turn and repaints when anything it shows has changed -- a call's status, its elapsed tenths of a second, a new line of thought -- so a running call's clock ticks and a finished one flips in place. The drawing itself is presentation methods under the cassette view, one per kind of record, so a wall can draw the same cards later from the same objects.