diff --git a/scripts/s/sh b/scripts/s/sh index 2a8fa9c..f01e4d2 100755 --- a/scripts/s/sh +++ b/scripts/s/sh @@ -47,9 +47,20 @@ Flags: Input at the prompt: submit prompt, stream response - /q enqueue prompt for later - / send to session ctl (e.g. /compact, /clear) + /stop interrupt the current agent turn /kill kill the session and exit + /compact compact conversation history + /clear clear conversation history + /rn rename the session + /cwd [path] get or set working directory + /agent [name] get or set agent + /model [name] get or set model + /backend [name] get or set backend + /models list available models + /backends list available backends + /usage show token usage + /ctxsz show context size + /q enqueue prompt for later Ctrl-C interrupt running turn (or exit if idle) EOF exit 0 @@ -144,11 +155,31 @@ while true; do [ -z "$input" ] && continue history -s "$input" case "$input" in - /kill) printf 'kill\n' > "$S/ctl"; break ;; - "/q "*) printf '%s\n' "${input#/q }" > "$S/enqueue" - printf 'queued\n' >&2; continue ;; - /*) printf '%s\n' "$input" > "$S/ctl" ;; - *) printf '%s' "$input" > "$S/prompt" || { printf 'submit failed\n' >&2; continue; } ;; + /stop) printf 'stop\n' > "$S/ctl"; continue ;; + /kill) printf 'kill\n' > "$S/ctl"; break ;; + /compact) printf 'compact\n' > "$S/ctl"; continue ;; + /clear) printf 'clear\n' > "$S/ctl"; continue ;; + "/rn "*) newid=${input#/rn } + printf 'rn %s\n' "$newid" > "$S/ctl" + id=$newid; S=$MOUNT/s/$id + save_session "$_dir" "$id"; continue ;; + /cwd) cat "$S/cwd" 2>/dev/null; printf '\n'; continue ;; + "/cwd "*) newcwd=${input#/cwd } + printf 'cwd %s\n' "$newcwd" > "$S/ctl"; continue ;; + /agent) cat "$S/agent" 2>/dev/null; printf '\n'; continue ;; + "/agent "*) printf '%s\n' "${input#/agent }" > "$S/agent"; continue ;; + /model) cat "$S/model" 2>/dev/null; printf '\n'; continue ;; + "/model "*) printf '%s\n' "${input#/model }" > "$S/model"; continue ;; + /backend) cat "$S/backend" 2>/dev/null; printf '\n'; continue ;; + "/backend "*) printf '%s\n' "${input#/backend }" > "$S/backend"; continue ;; + /models) cat "$S/models" 2>/dev/null; continue ;; + /backends) cat "$MOUNT/backends" 2>/dev/null; continue ;; + /usage) cat "$S/usage" 2>/dev/null; continue ;; + /ctxsz) cat "$S/ctxsz" 2>/dev/null; continue ;; + "/q "*) printf '%s\n' "${input#/q }" > "$S/enqueue" + printf 'queued\n' >&2; continue ;; + /*) printf 'unknown command: %s\n' "${input%% *}" >&2; continue ;; + *) printf '%s' "$input" > "$S/prompt" || { printf 'submit failed\n' >&2; continue; } ;; esac sleep 0.15 while true; do