2.0 KiB
Gral
Clone the repository, then install with npm install -g ..
Usage: gral <function> -p <prompt>, or pass a file as a prompt instead with the -f <prompt-file> option. 'main' is the default function if it exists, otherwise a function name is required.
Gral uses the .gral directory from the working path for its configuration. The horde connection uses the 'host' and 'token' values stored in .gral/config.json, or loads them from the environment if not present.
Every javascript module in .gral/functions exports a default function, it receives a single prompt string argument. These are the functions invoked by the gral command, you can list them with gral -l.
Shared libraries live in .gral/lib. Any module there can be imported from a function module using the @lib/ prefix.
The Gral global is available in the function module scopes, and exposes:
path: the working directoryrun: the run command for sending prompts to agents
The run function is the main harness functionality, it prompts agents with a tool bundle restricted based on the arguments.
agentId: the target agent that will process the promptinstructioninputandmessages: these are sent to the horde 'prompt' action as the main input for the agentreadandwrite: list of files and directories open for access during the run.nullandtruemeans allow all,falseand[]means allow none.open: files and directories to open beforehand and send as context for the runtools: tools to pass the agentdefaultTools: list of default tools to include in the list, special values are the same as read and write
Default tools include these:
read-file: read a file, max size of 1kb, with optionallineStartandlineEndargumentswrite-file: write the entire content of a file, no write limitupdate-file: acceptssearchandreplacearguments, and an optionalglobalargumentlist-dir: lists the contents of a directory (directories are distinguished by their '/' prefix)