luv

Workshop wiki

application-agent.lisp

luft/render/application-agent.lisp

system luft/render · 23 definitions · on GitHub

in-package#:luft.render

luft's agent is an application instrument with no panel of its own. The shared harness supplies turns, tools, transcript, and teardown; this file contributes a viewer report, a small atelier command vocabulary, and the canvas/frame relationship. There is deliberately no gnome, cat, body, or block-world language here.

defclassviewer-agent-report
projection:initarg:projection:readerviewer-report-projection
camera-position:initarg:camera-position:readerviewer-report-camera-position
bevel-width:initarg:bevel-width:readerviewer-report-bevel-width
construction-lines-p:initarg:construction-lines-p:readerviewer-report-construction-lines-p
inspection:initarg:inspection:readerviewer-report-inspection
clim:define-presentation-methodclim:present
objectstream
viewclim:textual-view
&key
let
position
viewer-report-camera-positionobject
formatstream"LUFT uses ~(~A~) projection; camera ~,2F, ~,2F, ~,2F; bevel ~A; construction lines ~:[off~;on~]~:[.~;, inspecting a boundary site.~]"
viewer-report-projectionobject
vec3:vec3-xposition
vec3:vec3-yposition
vec3:vec3-zposition
bevel-width-label
viewer-report-bevel-widthobject
viewer-report-construction-lines-pobject
viewer-report-inspectionobject
defunmake-viewer-agent-report
make-instance'viewer-agent-report:projection*projection*:camera-position
camera-position
viewer-cameraviewer
:bevel-width
viewer-bevel-widthviewer
:construction-lines-p:inspection
viewer-inspectionviewer
clim:define-command
com-describe-viewer:command-tableluft-atelier:name"Describe Viewer"
"Report LUFT's current camera and construction presentation state."
clim:define-command
com-set-projection:command-tableluft-atelier:name"Set Projection"
projection'
member:perspective:isometric
:prompt"perspective or isometric"
"Set LUFT's camera projection to perspective or isometric."
setf*projection*projection
let
when
viewer-rendererviewer
setf
renderer-history-valid-p
viewer-rendererviewer
nil
defparameter*viewer-agent-model*

gpt-5.6

defparameter*viewer-agent-commands*'
com-describe-viewercom-set-projectioncom-reset-viewcom-toggle-construction-linescom-toggle-bevel-width
defparameter*viewer-agent-instructions*

You are the application agent for luft, a live Common Lisp solid-model atelier and game experiment. Use the viewer's own commands to inspect or alter its developer presentation. Keep answers short and prefer acting through tools.

An invisible instrument gives the agent the viewer's ordinary transactional release path. Registry mutation and provider close remain independently idempotent when stop, REPL cleanup, and error recovery race.

defclassviewer-agent-instrument
agent:initarg:agent:readerviewer-agent-instrument-agent
defvar*viewer-agent-attachments*
make-hash-table:test#'eq:weakness:key
defvar*viewer-agent-attachments-lock*
sb-thread:make-mutex:name"LUFT viewer agents"
defmethodviewer-instrument-present-p
declare
ignoreinstrumentviewer
nil
defunviewer-agent

Return viewer's live application agent, or NIL.

alexandria:when-let
let
agent
viewer-agent-instrument-agentattachment
defunattach-viewer-agent
vieweragent

Attach already-open agent transactionally, releasing a concurrent loser.

let
attachment
make-instance'viewer-agent-instrument:agentagent
installed-pnil
winnernil
sb-thread:with-mutex
let
ifpresent
setfwinner
viewer-agent-instrument-agentpresent
setfattachmentwinneragentinstalled-pt
ifinstalled-p
progn

A concurrent release-viewer-agent may have detached and closed it between registry publication and instrument attachment.

agent
defunviewer-openai-api-key
or
openai:default-api-key
alexandria:when-let
luv.lobby:lobby-client-value
viewer-lobby-clientattachment
"OPENAI_API_KEY"
defunmake-viewer-agent
viewer&key
reasoning-summary"auto"
reasoning-effort

Open and attach viewer's environment-level agent.

Call this from SLY or another worker, never from a canvas command: opening a provider connection is application setup, while ask itself returns at once.

or
attach-viewer-agentviewer
luv.application-agent:make-application-agent:class'viewer-agent:applicationviewer:modelmodel:commandscommands:instructionsinstructions:reasoning-summaryreasoning-summary:reasoning-effortreasoning-effort:api-keyapi-key
defunask-viewer-agent
viewertext

Start a provider turn for viewer and return its turn immediately.

luv.application-agent:asktext:agent
or
error"No LUFT agent is open; call MAKE-VIEWER-AGENT off-canvas."
defunrelease-viewer-agent

Detach and close viewer's application agent if one exists.

let
attachmentnil
whenattachment

If creation has published the registry but not attached the instrument yet, release it directly; the creator detects the terminal state.

t