Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,8 @@ always go to Evil modes if you need to with ~C-z~).
| agent-shell-path-resolver-function | Function for resolving remote paths on the local file-system, and vice versa. |
| agent-shell-permission-icon | Icon displayed when shell commands require permission to execute. |
| agent-shell-pi-acp-command | Command and parameters for the Pi ACP client. |
| agent-shell-pi-default-model-id | Default Pi model ID. |
| agent-shell-pi-default-session-mode-id | Default Pi session mode ID. |
| agent-shell-pi-environment | Environment variables for the Pi client. |
| agent-shell-prefer-viewport-interaction | Non-nil makes ‘agent-shell’ prefer viewport interaction over shell interaction. |
| agent-shell-preferred-agent-config | Default agent to use for all new shells. |
Expand Down
24 changes: 24 additions & 0 deletions agent-shell-pi.el
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,26 @@ Example usage to set custom environment variables:
:type '(repeat string)
:group 'agent-shell)

(defcustom agent-shell-pi-default-model-id
nil
"Default Pi model ID.

Must be one of the model ID's displayed under \"Available models\"
when starting a new shell.

Can be set to either a string or a function that returns a string."
:type '(choice (const nil) string function)
:group 'agent-shell)

(defcustom agent-shell-pi-default-session-mode-id
nil
"Default Pi session mode ID.

Must be one of the mode ID's displayed under \"Available modes\"
when starting a new shell."
:type '(choice (const nil) string)
:group 'agent-shell)

(defun agent-shell-pi-make-agent-config ()
"Create a Pi coding agent configuration.

Expand All @@ -81,6 +101,10 @@ Returns an agent configuration alist using `agent-shell-make-agent-config'."
:welcome-function #'agent-shell-pi--welcome-message
:client-maker (lambda (buffer)
(agent-shell-pi-make-client :buffer buffer))
:default-model-id (lambda () (if (functionp agent-shell-pi-default-model-id)
(funcall agent-shell-pi-default-model-id)
agent-shell-pi-default-model-id))
:default-session-mode-id (lambda () agent-shell-pi-default-session-mode-id)
:install-instructions "See https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent for Pi installation.
Requires pi-acp adapter for ACP integration."))

Expand Down
16 changes: 14 additions & 2 deletions agent-shell.el
Original file line number Diff line number Diff line change
Expand Up @@ -2296,8 +2296,20 @@ COMMAND, when present, may be a shell command string or an argv vector."
(t (error "Unexpected tool-call command type: %S" (type-of command)))))

(defun agent-shell--active-requests-p (state)
"Return non-nil if STATE has in-flight requests awaiting responses."
(map-elt state :active-requests))
"Return non-nil if STATE has an in-flight request running a prompt turn.

Only turn-running requests count. Non-turn requests
like `session/set_model' must not mark the shell as in-turn:
notifications arriving while they are in flight (e.g. an agent
greeting) render above the live prompt, not after it."
(seq-find (lambda (request)
(member (map-elt request :method)
(append '("session/prompt"
"session/load"
"session/resume"
"session/fork")
(agent-shell-experimental--methods))))
(map-elt state :active-requests)))

(defun agent-shell--make-out-of-session-turn-notification-body (state acp-notification)
"Build a fragment body for ACP-NOTIFICATION arriving out of turn using STATE."
Expand Down
Loading