This started as a feature branch and then I ended up building a bunch of related stuff into it, merging it now.
Summary of changes:
Added Goal Mode, when you're in Shell Mode you can start a command with ! to have the AI automatically execute commands while trying to achieve a goal. Highly experimental. Use !! to allow command execution without confirmation.
Added Plugin Mode, which allows you to use https://butterfi.sh as a plugin that executes commands on the machine running plugin mode. Also highly experimental.
Truncate requests to model windows based on tokenization lengths rather than a very rough calculation based on the number of bytes. This should use token context windows more efficiently. It uses https://github.com/pkoukk/tiktoken-go.
Detect appropriate context window lengths based on the model name, e.g. you can do butterfish shell -m gpt-4 without the --prompt-history-window 6000 flag and still use up the token window. This removes the prompt-history-window shell flag.
Add a shell --max-history-block-tokens flag that allows you to tune the maximum number of tokens used for a single history line-item.
Add a shell --shell-binary flag which allows you to configure which system shell you want to launch.
Remove the shell --command-prompt flag in favor of --no-command-prompt to disable this functionality (rather than setting the emoji).
Add a shell mode light background theme you can trigger with --light-color.
Fix a race condition around the tricky operation of asking the terminal for the current cursor position (the \x1b[6n escape code). I'm not certain but I think this fixes #5.
Add a History command which shows what's in the recent history buffer.
Fix bug where using up/down arrows to page through recent commands breaks things.
Tweak shell mode system message for better overall results.
This started as a feature branch and then I ended up building a bunch of related stuff into it, merging it now.
Summary of changes:
!
to have the AI automatically execute commands while trying to achieve a goal. Highly experimental. Use!!
to allow command execution without confirmation.butterfish shell -m gpt-4
without the--prompt-history-window 6000
flag and still use up the token window. This removes theprompt-history-window
shell flag.--max-history-block-tokens
flag that allows you to tune the maximum number of tokens used for a single history line-item.--shell-binary
flag which allows you to configure which system shell you want to launch.--command-prompt
flag in favor of--no-command-prompt
to disable this functionality (rather than setting the emoji).--light-color
.\x1b[6n
escape code). I'm not certain but I think this fixes #5.History
command which shows what's in the recent history buffer.