Add done_thinking and permission_requested hooks to user config#125
Add done_thinking and permission_requested hooks to user config#125sudo-tee merged 9 commits intosudo-tee:mainfrom
Conversation
This is meant to track the number of user initiated messages, the job_count available currently only counts the total job counts
sudo-tee
left a comment
There was a problem hiding this comment.
This is actually a really great idea.
I left a little comment about the user_message_count. I think it would be better to set it in the send_message
we already have a promise running for the duration of the message.
state.user_message_count +1 before the promise
and
|
Can you add some test cases in the Also can you add them to the README file with a short description / example. I just realised that the doc was missing for the other hooks and added them to the docs |
|
Alright, after thinking that adding the session info as a hook param would be nice to access the session title etc, I realized that the hook would only be called for the currently active session. I had to change the two subscribed function in core into "private-ish" functions in order to use them in the unit tests, I'm not sure if that's fine or not. |
|
Thanks for the fixes. It looks fine to me |

I felt like having system notifications on certain opencode events would be really nice, so I implemented those two hooks available in the user config.
I had to add a "user_message_count" to the state to track the user initiated requests rather than all requests otherwise the hook would trigger even if the user didn't send anything.
I'm not sure that the mechanism to determine if a job is user initiated is correct, it works for me but there might be edge cases that I'm not aware of.