You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RFC: #1050
This PR begins implements the required logic for executing hooks. This PR has pending follow ups to handle the remaining items.
Note that the logic is currently inaccessible from a normal chat session.
It implements:
- "Hooks", which are defined in the context json files. They are loaded along with the normal context.
- "conversation_start" hooks that run once and are attached to the top of the context,
- "per_prompt" hooks that run each time there is a prompt, and are attached to the user prompt.
- Start with 1 hook type, "inline hooks", which simple execute a bash command.
- A HookExecutor to asynchronously call hooks in order from the configs.
- Logic to add/remove/enable/disable hooks via commands
- A cache to hold recent executions of hooks to avoid calling them too much.
- "conversation_start" hooks are held in cache indefinitely. "per_prompt" hooks can have
- The bash execution logic from `exceute_bash` tool was moved to a helper function so that it can be re-used here.
Remaining items in another PR:
- Call the hooks during a chat session and attach them to context appropriately
- Commands to enable, disable, add, and show hooks
- Add `Criticality` as according to the spec
- Handle user having multiple hooks with the same name (enforce uniqueness)
- Remaining tests
0 commit comments