o: add generate command for one-shot prompts
Uses /generate 9P file - no session/agent context needed. Example: o generate 'explain monads'
This commit is contained in:
parent
865378c150
commit
0f29757dac
|
|
@ -200,6 +200,27 @@ cmd_ls() {
|
|||
fi
|
||||
}
|
||||
|
||||
cmd_generate() {
|
||||
# One-shot generation via /generate (no session/agent needed)
|
||||
# Usage: o generate "prompt"
|
||||
# echo "prompt" | o generate
|
||||
# o generate -1 "prompt" (same as above)
|
||||
local prompt=""
|
||||
|
||||
# Handle -1 flag (ignored, for compatibility)
|
||||
[[ "${1:-}" == "-1" ]] && shift
|
||||
|
||||
if [[ $# -gt 0 ]]; then
|
||||
prompt="$*"
|
||||
else
|
||||
prompt=$(cat)
|
||||
fi
|
||||
|
||||
[[ -z "$prompt" ]] && { echo "usage: o generate <prompt>" >&2; exit 1; }
|
||||
|
||||
printf '%s' "$prompt" | ollie-9p rdwr generate
|
||||
}
|
||||
|
||||
cmd_readloop() {
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo "usage: o readloop <path>" >&2
|
||||
|
|
@ -388,6 +409,8 @@ Commands:
|
|||
readloop <path> Read in a loop (re-reads after return)
|
||||
ls [path] List namespace entries
|
||||
|
||||
generate <prompt> One-shot generation (no session needed)
|
||||
|
||||
ctl <cmd> Send control command to agent
|
||||
stop Interrupt running agent
|
||||
kill Kill active session
|
||||
|
|
@ -408,6 +431,7 @@ Examples:
|
|||
o ls # list at current context level
|
||||
o ls session # list all sessions
|
||||
o read models # read root-level file
|
||||
o generate "explain monads" # one-shot, no session
|
||||
export session=foo agent=bar # set context
|
||||
o read chat # read agent's chat
|
||||
o readloop statewait # blocks until agent state changes
|
||||
|
|
@ -427,6 +451,7 @@ case "$subcmd" in
|
|||
write) cmd_write "$@" ;;
|
||||
readloop) cmd_readloop "$@" ;;
|
||||
ls) cmd_ls "$@" ;;
|
||||
generate) cmd_generate "$@" ;;
|
||||
ctl) cmd_ctl "$@" ;;
|
||||
stop) cmd_stop "$@" ;;
|
||||
kill) cmd_kill "$@" ;;
|
||||
|
|
|
|||
Loading…
Reference in New Issue