feat(agent): added per-call tool concurrency resolver and parallel bash execution

- Extended `AgentTool.concurrency` to accept per-call resolver functions and resolved concurrency mode from each tool call, falling back to exclusive on resolver errors.
- Updated BashTool to schedule non-PTY calls as shared and PTY calls as exclusive so non-interactive bash calls can run in parallel within one message.
- Tracked in-use persistent shell sessions in the bash executor and routed overlapping calls on the same session key to isolated one-shot shells while preserving owner session availability.
This commit is contained in:
can1357
2026-06-11 18:13:07 +02:00
parent 926dfdea39
commit ce4ebad726
11 changed files with 180 additions and 10 deletions
+2
View File
@@ -101,6 +101,8 @@ Session-level bang-command executions pass `sessionKey: this.sessionId`.
Tool-call executions pass `sessionKey: this.session.getSessionId?.()`, when available. In both surfaces, a session key isolates shell reuse per session; without one, reuse falls back to shell config/snapshot/env.
Concurrent calls never share one `Shell`: the native session runs one command at a time and `Shell.abort()` kills every in-flight run on it. `executeBash()` tracks in-flight keys in `shellSessionsInUse`; while a key is busy, overlapping calls skip the cache and run through one-shot `executeShell()` (same isolation as quarantined sessions). Only the owning call releases the in-use flag or deletes the cached session in its `finally`.
## Shell config and snapshot behavior
At each call, executor loads settings shell config (`shell`, `env`, optional `prefix`).