about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2026-04-10 01:06:04 +0100
committerArun Isaac2026-04-10 01:07:21 +0100
commit70abbe3b69a6474c62c162fa1ca65ef1e95417ff (patch)
tree96c283307132a9ce2795e8c0fa6f46ccf7f5cefa
parent870e714d62ac5baa1b5faf28f091a1eff209d976 (diff)
downloadkaagum-70abbe3b69a6474c62c162fa1ca65ef1e95417ff.tar.gz
kaagum-70abbe3b69a6474c62c162fa1ca65ef1e95417ff.tar.lz
kaagum-70abbe3b69a6474c62c162fa1ca65ef1e95417ff.zip
Pass tools to slash commands.
This is becoming a hodge-podge of arguments passed in to slash
commands. We need a more principled approach in the future.
-rw-r--r--kaakaa/tea.scm20
1 files changed, 12 insertions, 8 deletions
diff --git a/kaakaa/tea.scm b/kaakaa/tea.scm
index d9a6c00..a4cf250 100644
--- a/kaakaa/tea.scm
+++ b/kaakaa/tea.scm
@@ -191,7 +191,7 @@ in @var{state}."
 
 (define %cwd-command
   (command "Print current working directory of the session"
-           (lambda (state session-id _)
+           (lambda (state session-id tools argument)
              (values state
                      (list (agent-message-chunk session-id
                                                 (focus (state-cwd session-id)
@@ -200,25 +200,29 @@ in @var{state}."
 (define %commands
   `(("cwd" . ,%cwd-command)))
 
-(define (next-state-slash-command state session-id command-name argument)
+(define (next-state-slash-command state session-id tools command-name argument)
   "Given current @var{state} and an invocation of slash var{command-name} with
 @var{argument} for @var{session-id}, return the next state and a list of
-effects."
+effects.
+
+@var{tools} is the same as in @code{tea-loop}."
   (cond
    ;; command exists
    ((focus (key-ref command-name)
            %commands)
     => (lambda (command)
-         ((command-next-state command) state session-id argument)))
+         ((command-next-state command) state session-id tools argument)))
    ;; command not found
    (else
     (values state
             (list (agent-message-chunk session-id
                                        "Error: Unknown command"))))))
 
-(define (next-state-client-request state request)
+(define (next-state-client-request state request tools)
   "Given current @var{state} and a new ACP @var{request}, return the next state and
-a list of effects."
+a list of effects.
+
+@var{tools} is the same as in @code{tea-loop}."
   (let ((request-id (focus (key-ref "id")
                            request)))
     (cond
@@ -288,7 +292,7 @@ a list of effects."
                            (argument (string-trim (match:substring mtch 2))))
                        (let-values (((state effects)
                                      (next-state-slash-command
-                                      state session-id command-name argument)))
+                                      state session-id tools command-name argument)))
                          (values state
                                  ;; End prompt turn immediately. This means
                                  ;; slash commands cannot send LLM requests or
@@ -618,7 +622,7 @@ list of effects.
           (next-state-client-response state json-message)
           ;; message is a request/notification from the client.
           (let-values (((state effects)
-                        (next-state-client-request state json-message)))
+                        (next-state-client-request state json-message tools)))
             (values (cond
                      ;; message is a request from the client.
                      ((focus (key-ref "id") json-message)