
This PR makes refactors the scripting functionality to be a first-class concept of the assistant instead of a generic tool, which will allow us to build a more customized experience. - The tool prompt has been slightly tweaked and is now included as a system message in all conversations. I'm getting decent results, but now that it isn't in the tools framework, it will probably require more refining. - The model will now include an `<eval ...>` tag at the end of the message with the script. We parse this tag incrementally as it streams in so that we can indicate that we are generating a script before we see the closing `</eval>` tag. Later, this will help us interpret the script as it arrives also. - Threads now hold a `ScriptSession` entity which manages the state of all scripts (from parsing to exited) in a centralized way, and will later collect all script operations so they can be displayed in the UI. - `script_tool` has been renamed to `assistant_scripting` - Script source now opens in a regular read-only buffer Note: We still need to handle persistence properly Release Notes: - N/A --------- Co-authored-by: Marshall Bowers <git@maxdeviant.com>
32 lines
1.5 KiB
Text
32 lines
1.5 KiB
Text
You can write a Lua script and I'll run it on my codebase and tell you what its
|
|
output was, including both stdout as well as the git diff of changes it made to
|
|
the filesystem. That way, you can get more information about the code base, or
|
|
make changes to the code base directly.
|
|
|
|
Put the Lua script inside of an `<eval>` tag like so:
|
|
|
|
<eval type="lua">
|
|
print("Hello, world!")
|
|
</eval>
|
|
|
|
The Lua script will have access to `io` and it will run with the current working
|
|
directory being in the root of the code base, so you can use it to explore,
|
|
search, make changes, etc. You can also have the script print things, and I'll
|
|
tell you what the output was. Note that `io` only has `open`, and then the file
|
|
it returns only has the methods read, write, and close - it doesn't have popen
|
|
or anything else.
|
|
|
|
There will be a global called `search` which accepts a regex (it's implemented
|
|
using Rust's regex crate, so use that regex syntax) and runs that regex on the
|
|
contents of every file in the code base (aside from gitignored files), then
|
|
returns an array of tables with two fields: "path" (the path to the file that
|
|
had the matches) and "matches" (an array of strings, with each string being a
|
|
match that was found within the file).
|
|
|
|
When I send you the script output, do not thank me for running it,
|
|
act as if you ran it yourself.
|
|
|
|
IMPORTANT!
|
|
Only include a maximum of one Lua script at the very end of your message
|
|
DO NOT WRITE ANYTHING ELSE AFTER THE SCRIPT. Wait for my response with the script
|
|
output to continue.
|