add -r/--reset and -t/--tail options; update README
This commit is contained in:
@@ -6,7 +6,7 @@ image: https://example.com/cover.png
|
|||||||
tags: [ai, agent, aiharness]
|
tags: [ai, agent, aiharness]
|
||||||
---
|
---
|
||||||
|
|
||||||
# aish
|
# aish <sub><sup><sub><sup>v0.0.1</sup></sub></sup></sub>
|
||||||
|
|
||||||
```
|
```
|
||||||
, ,
|
, ,
|
||||||
@@ -61,6 +61,7 @@ With options:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ ./ai.sh -v what is 2 plus 2
|
$ ./ai.sh -v what is 2 plus 2
|
||||||
|
|
||||||
[loaded /home/user/.aish/log.jsonl — 3 messages, $0.0001 spent]
|
[loaded /home/user/.aish/log.jsonl — 3 messages, $0.0001 spent]
|
||||||
[step 1] (reasoning) The user wants to know 2 plus 2.
|
[step 1] (reasoning) The user wants to know 2 plus 2.
|
||||||
[done] 2 plus 2 is 4.
|
[done] 2 plus 2 is 4.
|
||||||
@@ -68,21 +69,8 @@ $ ./ai.sh -v what is 2 plus 2
|
|||||||
[finished — 1 steps, $0.0001 spent]
|
[finished — 1 steps, $0.0001 spent]
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
|
||||||
$ ./ai.sh -m gpt-4o "write a hello world program in python. save it in ~/"
|
|
||||||
I've created a Python hello world program at ~/hello.py:
|
|
||||||
|
|
||||||
```python
|
|
||||||
print("Hello, World!")
|
|
||||||
```
|
|
||||||
|
|
||||||
You can run it with `python3 ~/hello.py`.
|
|
||||||
```
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ ./ai.sh -R what is the capital of France
|
|
||||||
The capital of France is Paris.
|
|
||||||
```
|
|
||||||
|
|
||||||
The agent can run shell commands, read files, and execute multi-step
|
The agent can run shell commands, read files, and execute multi-step
|
||||||
tasks. Context is saved and resumed on subsequent calls.
|
tasks. Context is saved and resumed on subsequent calls.
|
||||||
@@ -225,14 +213,16 @@ That's it. No build step, no install script, no daemon.
|
|||||||
| `-a` | `--autonomous` | Autonomous mode (run until done or budget exhausted) |
|
| `-a` | `--autonomous` | Autonomous mode (run until done or budget exhausted) |
|
||||||
| `-i` | `--init` | Create local `.aish/` with defaults, exit |
|
| `-i` | `--init` | Create local `.aish/` with defaults, exit |
|
||||||
| `-x` | `--clear` | Clear the log file and exit |
|
| `-x` | `--clear` | Clear the log file and exit |
|
||||||
|
| `-r` | `--reset` | Clear the log file and exit (alias for `-x`) |
|
||||||
|
| `-t` | `--tail` | Tail (follow) the log file in real time |
|
||||||
| `-v` | `--verbose` | Show status lines |
|
| `-v` | `--verbose` | Show status lines |
|
||||||
| `-m` | `--model` | Override model |
|
| `-m` | `--model` | Override model |
|
||||||
| `-k` | `--api-key` | API key (or set `PPQ_API_KEY`) |
|
| `-k` | `--api-key` | API key (or set `PPQ_API_KEY`) |
|
||||||
| `-C` | `--max-cost` | Override max cost (USD) |
|
| `-C` | `--max-cost` | Override max cost (USD) |
|
||||||
| `-s` | `--max-steps` | Override max steps |
|
| `-s` | `--max-steps` | Override max steps |
|
||||||
| `-t` | `--timeout` | Override overall timeout (seconds) |
|
| | `--timeout` | Override overall timeout (seconds) |
|
||||||
| `-T` | `--cmd-timeout` | Override per-command timeout (seconds) |
|
| `-T` | `--cmd-timeout` | Override per-command timeout (seconds) |
|
||||||
| `-r` | `--resume` | Resume from existing log (default: yes) |
|
| | `--resume` | Resume from existing log (default: yes) |
|
||||||
| `-R` | `--no-resume` | Start fresh (ignore existing log) |
|
| `-R` | `--no-resume` | Start fresh (ignore existing log) |
|
||||||
| `-h` | `--help` | Show help |
|
| `-h` | `--help` | Show help |
|
||||||
|
|
||||||
|
|||||||
@@ -170,15 +170,17 @@ Options:
|
|||||||
-a, --autonomous Run in autonomous mode (goal required)
|
-a, --autonomous Run in autonomous mode (goal required)
|
||||||
-i, --init Create local .aish/ with default config + prompt, exit
|
-i, --init Create local .aish/ with default config + prompt, exit
|
||||||
-x, --clear Clear the log file and exit
|
-x, --clear Clear the log file and exit
|
||||||
|
-r, --reset Clear the log file and exit (alias for -x)
|
||||||
|
-t, --tail Tail (follow) the log file in real time
|
||||||
-v, --verbose Show status lines ([loaded], [step], [finished], etc.)
|
-v, --verbose Show status lines ([loaded], [step], [finished], etc.)
|
||||||
Default is quiet: only the response is printed.
|
Default is quiet: only the response is printed.
|
||||||
-m, --model MODEL Override model from config
|
-m, --model MODEL Override model from config
|
||||||
-k, --api-key KEY API key (or set PPQ_API_KEY env var)
|
-k, --api-key KEY API key (or set PPQ_API_KEY env var)
|
||||||
-C, --max-cost USD Override max cost from config
|
-C, --max-cost USD Override max cost from config
|
||||||
-s, --max-steps N Override max steps from config
|
-s, --max-steps N Override max steps from config
|
||||||
-t, --timeout SECS Override overall timeout from config
|
--timeout SECS Override overall timeout from config
|
||||||
-T, --cmd-timeout SECS Override per-command timeout from config
|
-T, --cmd-timeout SECS Override per-command timeout from config
|
||||||
-r, --resume Resume from existing log (default: yes)
|
--resume Resume from existing log (default: yes)
|
||||||
-R, --no-resume Start fresh (ignore existing log)
|
-R, --no-resume Start fresh (ignore existing log)
|
||||||
-h, --help Show this help
|
-h, --help Show this help
|
||||||
|
|
||||||
@@ -202,6 +204,7 @@ IS_AUTONOMOUS=0
|
|||||||
CMD_MODE=0
|
CMD_MODE=0
|
||||||
INIT_MODE=0
|
INIT_MODE=0
|
||||||
CLEAR_MODE=0
|
CLEAR_MODE=0
|
||||||
|
TAIL_MODE=0
|
||||||
VERBOSE=0
|
VERBOSE=0
|
||||||
MODEL_OVERRIDE=""
|
MODEL_OVERRIDE=""
|
||||||
API_KEY_OVERRIDE=""
|
API_KEY_OVERRIDE=""
|
||||||
@@ -1058,10 +1061,14 @@ while [ $i -le $# ]; do
|
|||||||
INIT_MODE=1
|
INIT_MODE=1
|
||||||
i=$((i+1))
|
i=$((i+1))
|
||||||
;;
|
;;
|
||||||
--clear|-x)
|
--clear|-x|--reset|-r)
|
||||||
CLEAR_MODE=1
|
CLEAR_MODE=1
|
||||||
i=$((i+1))
|
i=$((i+1))
|
||||||
;;
|
;;
|
||||||
|
--tail|-t)
|
||||||
|
TAIL_MODE=1
|
||||||
|
i=$((i+1))
|
||||||
|
;;
|
||||||
--model|-m)
|
--model|-m)
|
||||||
i=$((i+1)); eval "MODEL_OVERRIDE=\"\${$i}\""; i=$((i+1))
|
i=$((i+1)); eval "MODEL_OVERRIDE=\"\${$i}\""; i=$((i+1))
|
||||||
;;
|
;;
|
||||||
@@ -1076,7 +1083,7 @@ while [ $i -le $# ]; do
|
|||||||
i=$((i+1)); eval "MAX_STEPS_OVERRIDE=\"\${$i}\""
|
i=$((i+1)); eval "MAX_STEPS_OVERRIDE=\"\${$i}\""
|
||||||
HAS_MAX_STEPS=1; i=$((i+1))
|
HAS_MAX_STEPS=1; i=$((i+1))
|
||||||
;;
|
;;
|
||||||
--timeout|-t)
|
--timeout)
|
||||||
i=$((i+1)); eval "TIMEOUT_OVERRIDE=\"\${$i}\""
|
i=$((i+1)); eval "TIMEOUT_OVERRIDE=\"\${$i}\""
|
||||||
HAS_TIMEOUT=1; i=$((i+1))
|
HAS_TIMEOUT=1; i=$((i+1))
|
||||||
;;
|
;;
|
||||||
@@ -1084,7 +1091,7 @@ while [ $i -le $# ]; do
|
|||||||
i=$((i+1)); eval "CMD_TIMEOUT_OVERRIDE=\"\${$i}\""
|
i=$((i+1)); eval "CMD_TIMEOUT_OVERRIDE=\"\${$i}\""
|
||||||
HAS_CMD_TIMEOUT=1; i=$((i+1))
|
HAS_CMD_TIMEOUT=1; i=$((i+1))
|
||||||
;;
|
;;
|
||||||
--resume|-r)
|
--resume)
|
||||||
RESUME=1; i=$((i+1))
|
RESUME=1; i=$((i+1))
|
||||||
;;
|
;;
|
||||||
--no-resume|-R)
|
--no-resume|-R)
|
||||||
@@ -1107,7 +1114,7 @@ while [ $i -le $# ]; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# --clear: delete the log file and exit.
|
# --clear / --reset: delete the log file and exit.
|
||||||
if [ "$CLEAR_MODE" = "1" ]; then
|
if [ "$CLEAR_MODE" = "1" ]; then
|
||||||
if [ -f "$LOG_PATH" ]; then
|
if [ -f "$LOG_PATH" ]; then
|
||||||
rm -f "$LOG_PATH"
|
rm -f "$LOG_PATH"
|
||||||
@@ -1118,6 +1125,17 @@ if [ "$CLEAR_MODE" = "1" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# --tail: follow the log file in real time.
|
||||||
|
if [ "$TAIL_MODE" = "1" ]; then
|
||||||
|
if [ -f "$LOG_PATH" ]; then
|
||||||
|
tail -f "$LOG_PATH"
|
||||||
|
else
|
||||||
|
echo "No log to tail ($LOG_PATH does not exist)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# --init: create local .aish/ with default config + prompt, then exit.
|
# --init: create local .aish/ with default config + prompt, then exit.
|
||||||
if [ "$INIT_MODE" = "1" ]; then
|
if [ "$INIT_MODE" = "1" ]; then
|
||||||
mkdir -p "$LOCAL_DIR" || { echo "error: failed to create $LOCAL_DIR" >&2; exit 1; }
|
mkdir -p "$LOCAL_DIR" || { echo "error: failed to create $LOCAL_DIR" >&2; exit 1; }
|
||||||
|
|||||||
Reference in New Issue
Block a user