fix: add create_agent_session and inject_formula to agent-session.sh
Both dev-agent.sh and gardener-agent.sh call these functions but they were never implemented during the #158 extraction. Adds: - create_agent_session(session, workdir) — tmux + claude + wait for ready - inject_formula(session, text) — alias for agent_inject_into_session
This commit is contained in:
parent
ae3e742f9f
commit
350acccd8b
1 changed files with 18 additions and 0 deletions
|
|
@ -40,6 +40,24 @@ agent_inject_into_session() {
|
|||
rm -f "$tmpfile"
|
||||
}
|
||||
|
||||
# Create a tmux session running Claude in the given workdir.
|
||||
# Returns 0 if session is ready, 1 otherwise.
|
||||
create_agent_session() {
|
||||
local session="$1"
|
||||
local workdir="${2:-.}"
|
||||
tmux new-session -d -s "$session" -c "$workdir" \
|
||||
"claude --dangerously-skip-permissions" 2>/dev/null
|
||||
sleep 1
|
||||
tmux has-session -t "$session" 2>/dev/null || return 1
|
||||
agent_wait_for_claude_ready "$session" 120 || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
# Inject a prompt/formula into a session (alias for agent_inject_into_session).
|
||||
inject_formula() {
|
||||
agent_inject_into_session "$@"
|
||||
}
|
||||
|
||||
# Kill a tmux session gracefully (no-op if not found).
|
||||
agent_kill_session() {
|
||||
tmux kill-session -t "$1" 2>/dev/null || true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue