about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2026-04-18 03:03:45 +0100
committerArun Isaac2026-04-20 00:23:36 +0100
commit60a25919b1245070ee9707e55c406c03a3c2a1d6 (patch)
tree8674983fa57d209866dfe0669bdb6cd9ec1de7c1
parent5cc63a091a73e9e41897f1770fdc588f68df5bf6 (diff)
downloadkaagum-60a25919b1245070ee9707e55c406c03a3c2a1d6.tar.gz
kaagum-60a25919b1245070ee9707e55c406c03a3c2a1d6.tar.lz
kaagum-60a25919b1245070ee9707e55c406c03a3c2a1d6.zip
Report session cost to client.
-rw-r--r--kaagum/tea.scm12
1 files changed, 11 insertions, 1 deletions
diff --git a/kaagum/tea.scm b/kaagum/tea.scm
index 9b236e0..96fcc81 100644
--- a/kaagum/tea.scm
+++ b/kaagum/tea.scm
@@ -770,7 +770,17 @@ ending the turn of session with @var{session-id}."
                                            ("thoughtTokens" . ,thought-tokens)
                                            ("cachedReadTokens" . ,cache-read-tokens)
                                            ("cachedWriteTokens" . ,cache-write-tokens)))
-                                        '()))))))))
+                                        '()))))
+                  (acp-message `(("jsonrpc" . "2.0")
+                                 ("method" . "session/update")
+                                 ("params"
+                                  ("sessionId" . ,session-id)
+                                  ("update"
+                                   ("sessionUpdate" . "usage_update")
+                                   ("cost"
+                                    ("amount" . ,(focus (state-session-cost session-id)
+                                                        state))
+                                    ("currency" . "USD"))))))))))
 
 (define (next-state-llm-response state response tools)
   "Given current @var{state} and a new LLM @var{response}, return the next state