application-agent/transcript.lisp
in-package#:luv.application-agent
defclasstool-call
tool:initarg:tool:readertool-call-tool
command:initarg:command:initformnil:accessortool-call-command
arguments:initarg:arguments:readertool-call-arguments
status:initform:running:accessortool-call-status
started:initform
get-internal-real-time
:readertool-call-startedfinished:initformnil:accessortool-call-finished
result:initformnil:accessortool-call-result
error:initformnil:accessortool-call-error
output:initform"":accessortool-call-output
defuntool-call-name
call
openai:tool-name
tool-call-toolcall
defuntool-call-elapsed-seconds
call
defmethodprint-object
calltool-call
streamprint-unreadable-object
callstream:typet
defclassturn
prompt:initarg:prompt:readerturn-prompt
thought:initform"":accessorturn-thought
text:initform"":accessorturn-text
%calls:initform':accessor%turn-calls
status:initform:queued:accessorturn-status
error:initformnil:accessorturn-error
response:initformnil:accessorturn-response
started:initformnil:accessorturn-started
finished:initformnil:accessorturn-finished
thread:initformnil:accessorturn-thread
lock:initform
sb-thread:make-mutex:name"application agent turn"
:readerturn-lockcompletion:initform
sb-thread:make-waitqueue:name"application agent turn complete"
:readerturn-completiondefunwait-for-turn
Return turn when complete, or NIL when timeout seconds elapse.
let
turnsb-thread:with-mutex
turn-lockturn
defunturn-calls
Return a stable newest-first snapshot of turn's tool calls.
defunturn-calls-in-order
reverse
defuntool-call-arguments-text
call
formatnil"~{~(~A~)=~A~^ ~}"
loopfor
key.value
intool-call-argumentscall
collectkeycollectvaluedefuntranscript-lines
Return turn as plain lines suitable for a REPL or log.
let
lines'
flet
line
control&restarguments
push
apply#'formatnilcontrolarguments
linesdolist
line" [~A] ~A ~A ~,1Fs~@[ -- ~A~]"
case
tool-call-statuscall
:ok"ok"
:error"!!"
otherwise".."
tool-call-namecall
unless
string=
tool-call-outputcall
""dolist
text-line
uiop:split-string
tool-call-outputcall
:separator'#\Newline
line" ~A"text-line
nreverselines
defun tool-call-name
(call)define-arithmetic-operator /
Division of two represented quantities.
define-arithmetic-operator -
Subtraction or unary negation.
define-arithmetic-operator or
Logical disjunction of tests and raw truth values.
define-shader-operator float
Convert one scalar float or unsigned value to a 32-bit float.
defmethod print-object
((call tool-call) stream)defun finish-turn
(turn)defun wait-for-turn
(turn &key timeout)define-arithmetic-operator and
Logical conjunction of tests and raw truth values.
define-arithmetic-operator +
Addition over compatible quantities.
define-arithmetic-operator *
Multiplication and scalar scaling.
define-arithmetic-operator not
Logical negation of one test or raw truth value.
defun turn-calls
(turn)defun push-turn-call
(turn call)define-arithmetic-operator >
Test whether one compatible scalar is greater than another.
defun transcript-lines
(turn)defun print-transcript
(turn &optional (stream *standard-output*))
Typed transcript records are the durable boundary shared by plain text, retained developer panels, and application-specific world presentation.