feat: add hook after dream completion with customizable script#3118
Open
JiajunBernoulli wants to merge 3 commits into
Open
feat: add hook after dream completion with customizable script#3118JiajunBernoulli wants to merge 3 commits into
JiajunBernoulli wants to merge 3 commits into
Conversation
- Add hook_script config option to DreamConfig - Invoke user-defined hook script after Dream processing - Initialize default hook template in workspace/hooks/ - Hook receives context with changelog, cursor, batch, and result - Template includes three customizable functions: - _validate_result: validate memory keywords - _notify_user: send notifications - _save_to_external: save to external storage (Feishu, Tencent Docs, etc.) Closes HKUDS#3103
c0b252b to
1ae3ae5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
after_hook_scriptconfig option toDreamConfigfor custom post-dream processingworkspace/hooks/hook_after_dreaming.pychangelog,cursor,batch, andresult_validate_result,_notify_user,_save_to_externalChanges
nanobot/config/schema.py: Addafter_hook_script: str | NonetoDreamConfignanobot/agent/loop.py: Pass dream config (including after_hook_script) to Dreamnanobot/agent/memory.py:_invoke_hook_asyncmethod for async hook execution in thread poolafter_hook_scriptis configured.get()nanobot/utils/helpers.py: Initialize default hook template on workspace setupTests
Added comprehensive test suite in
tests/agent/test_dream.py::TestDreamHook:runfunction handled gracefullyPart1 in #3103