branch: externals/ellama
commit 11051563d85ef988e22493e3130e09a655872b85
Merge: 9352e29a3b e8cf2ccdca
Author: Sergey Kostyaev <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #388 from s-kostyaev/check-compile-warnings
Add native compilation warnings check
---
AGENTS.md | 1 +
Makefile | 5 ++++-
NEWS.org | 3 +++
ellama-tools.el | 63 ++++++++++++++++++++++++++++++++++++++-------------------
ellama.el | 2 +-
5 files changed, 51 insertions(+), 23 deletions(-)
diff --git a/AGENTS.md b/AGENTS.md
index 647bb3160d..a20bb84d4b 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -4,6 +4,7 @@
1. **Build**: `make build`
2. **Run unit tests** (ERT): `make test`
+3. **Check native compilation warnings**: `make check-compile-warnings`
## Code Style Guidelines
diff --git a/Makefile b/Makefile
index 06875dfe21..5867ac5550 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
# Makefile for ellama project
-.PHONY: build test
+.PHONY: build test check-compile-warnings
build:
emacs -batch --eval "(package-initialize)" -f batch-byte-compile
ellama*.el
@@ -8,5 +8,8 @@ build:
test:
emacs -batch --eval "(package-initialize)" -l ellama.el -l
tests/test-ellama.el --eval "(ert t)"
+check-compile-warnings:
+ emacs --batch --eval "(package-initialize)" --eval "(setq
native-comp-eln-load-path (list default-directory))" -L . -f
batch-native-compile ellama*.el
+
refill-news:
emacs -batch --eval "(with-current-buffer (find-file-noselect
\"./NEWS.org\") (setq fill-column 80) (fill-region (point-min) (point-max))
(save-buffer))"
diff --git a/NEWS.org b/NEWS.org
index 5af8a452a3..76a4bccc1b 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -1,3 +1,6 @@
+* Version 1.12.12
+- Add native compilation warnings check. This adds a new check-compile-warnings
+ Make target that allows developers to verify native compilation warnings.
* Version 1.12.11
- Fix duplicate system message handling in chat prompts. This change removes
the
redundant ~llm-chat-prompt-append-response~ call that was appending the
system
diff --git a/ellama-tools.el b/ellama-tools.el
index d88d6fa0df..0c049e0f42 100644
--- a/ellama-tools.el
+++ b/ellama-tools.el
@@ -33,6 +33,29 @@
(require 'json)
(require 'llm)
+(declare-function llm-standard-provider-p "llm-provider-utils" (provider))
+(declare-function ellama-new-session "ellama"
+ (provider prompt &optional ephemeral))
+(declare-function ellama-session-extra "ellama" (session))
+(declare-function ellama-session-id "ellama" (session))
+(declare-function ellama-stream "ellama" (prompt &rest args))
+
+(defvar ellama-provider)
+(defvar ellama-coding-provider)
+(defvar ellama--current-session)
+(defvar ellama--current-session-id)
+
+(defvar ellama-tools-available nil
+ "Alist containing all registered tools.")
+
+(defvar ellama-tools-enabled nil
+ "List of tools that have been enabled.")
+
+(defun ellama-tools--set-session-extra (session extra)
+ "Set SESSION EXTRA."
+ (with-no-warnings
+ (setf (ellama-session-extra session) extra)))
+
(defcustom ellama-tools-allow-all nil
"Allow `ellama' using all the tools without user confirmation.
Dangerous. Use at your own risk."
@@ -112,12 +135,6 @@ Tools from this list will work without user confirmation."
(setq provider (eval provider)))
provider)))
-(defvar ellama-tools-available nil
- "Alist containing all registered tools.")
-
-(defvar ellama-tools-enabled nil
- "List of tools that have been enabled.")
-
(defvar-local ellama-tools-confirm-allowed (make-hash-table)
"Contains hash table of allowed functions.
Key is a function name symbol. Value is a boolean t.")
@@ -828,8 +845,9 @@ CALLBACK will be used to report result asyncronously."
(let* ((extra (ellama-session-extra ,session))
(done (plist-get extra :task-completed)))
(unless done
- (setf (ellama-session-extra ,session)
- (plist-put extra :task-completed t))
+ (ellama-tools--set-session-extra
+ ,session
+ (plist-put extra :task-completed t))
(funcall ,callback result)))
"Result received. Task completed.")
:name "report_result"
@@ -849,12 +867,14 @@ CALLBACK will be used to report result asyncronously."
(done
(message "Subagent finished."))
((>= steps max)
- (setf (ellama-session-extra session)
- (plist-put extra :task-completed t))
+ (ellama-tools--set-session-extra
+ session
+ (plist-put extra :task-completed t))
(funcall callback (format "Max steps (%d) reached." max)))
(t
- (setf (ellama-session-extra session)
- (plist-put extra :step-count (1+ steps)))
+ (ellama-tools--set-session-extra
+ session
+ (plist-put extra :step-count (1+ steps)))
(ellama-stream
ellama-tools-subagent-continue-prompt
:session session
@@ -896,15 +916,16 @@ ROLE – role key from `ellama-tools-subagent-roles'."
;; Initialize session state (single source of truth)
;; ============================================================
- (setf (ellama-session-extra worker)
- (list
- :parent-session parent-id
- :role role-key
- :tools all-tools
- :result-callback callback
- :task-completed nil
- :step-count 0
- :max-steps steps-limit))
+ (ellama-tools--set-session-extra
+ worker
+ (list
+ :parent-session parent-id
+ :role role-key
+ :tools all-tools
+ :result-callback callback
+ :task-completed nil
+ :step-count 0
+ :max-steps steps-limit))
;; ============================================================
;; Start the agent loop
diff --git a/ellama.el b/ellama.el
index c3fd36d428..6dc1d1565e 100644
--- a/ellama.el
+++ b/ellama.el
@@ -6,7 +6,7 @@
;; URL: http://github.com/s-kostyaev/ellama
;; Keywords: help local tools
;; Package-Requires: ((emacs "28.1") (llm "0.24.0") (plz "0.8") (transient
"0.7") (compat "29.1") (yaml "1.2.3"))
-;; Version: 1.12.11
+;; Version: 1.12.12
;; SPDX-License-Identifier: GPL-3.0-or-later
;; Created: 8th Oct 2023