about summary refs log tree commit diff
path: root/emacs/agent-shell-kaagum.el
blob: 8e89cf59b20865256a6bb2034b8279bdc3fe6fc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
;;; agent-shell-kaagum.el --- Kaagum ACP agent configuration -*- lexical-binding: t; -*-

;; Copyright (C) 2026 Arun Isaac

;; Author: Arun Isaac <arunisaac@systemreboot.net>
;; Version: 0.1.0

;; This package is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; This package is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;;
;; This file includes a kaagum ACP agent configuration for testing.
;;
;; Point `agent-shell-kaagum-command' at the kaagum executable, and
;; set `agent-shell-kaagum-parameters' to a list of parameters to pass
;; to kaagum.

;;; Code:

(require 'agent-shell)
(require 'shell-maker)

(defcustom agent-shell-kaagum-command
  "kaagum"
  "Command for the kaagum agent."
  :type 'string
  :group 'agent-shell)

(defcustom agent-shell-kaagum-parameters
  '("--api-key-command=pass openrouter.ai")
  "Command parameters for the kaagum agent."
  :type '(repeat string)
  :group 'agent-shell)

(defun agent-shell-kaagum-make-agent-config ()
  "Create a kaagum ACP agent configuration.

Returns an agent configuration alist using `agent-shell-make-agent-config'."
  (agent-shell-make-agent-config
   :identifier 'kaagum
   :mode-line-name "kaagum"
   :buffer-name "kaagum"
   :shell-prompt "kaagum> "
   :shell-prompt-regexp "kaagum> "
   :welcome-function #'agent-shell-kaagum--welcome-message
   :client-maker #'agent-shell-kaagum-make-client))

(defun agent-shell-kaagum-start-agent ()
  "Start an interactive kaagum agent shell."
  (interactive)
  (agent-shell-start :config (agent-shell-kaagum-make-agent-config)))

(defun agent-shell-kaagum-make-client (buffer)
  "Create a kaagum ACP client using BUFFER as context."
  (agent-shell--make-acp-client :command agent-shell-kaagum-command
                                :command-params agent-shell-kaagum-parameters
                                :context-buffer buffer))

(defun agent-shell-kaagum--welcome-message (config)
  "Return kaagum welcome message using `shell-maker' CONFIG."
  (concat (propertize " 🐦‍⬛" 'font-lock-face '(:height 5.0))
          (string-trim-left (shell-maker-welcome-message config) "\n")))

(provide 'agent-shell-kaagum)

;;; agent-shell-kaagum.el ends here