refactor: extract agent loop into plugin, unify hooks and extension points #34
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Competitor
Kind/Documentation
Kind/Enhancement
Kind/Epic
Kind/Feature
Kind/Security
Kind/Story
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Scope/Core
Scope/Cross-Plugin
Scope/Plugin-System
Scope/Single-Plugin
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ultanio/cobot!34
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "nazim/cobot:refactor/loop-plugin-architecture"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Extracts the agent message loop from
agent.pyinto a loop plugin, and replaces the 11 hardcoded hooks with extension points. One dispatch mechanism. Agent becomes a loop runner.Closes #33
What changed
New: Loop plugin (
cobot/plugins/loop/)loop.on_message,loop.before_llm, etc.)meta.implementsdeclarationsSimplified:
agent.py(394→80 lines)New:
call_extension()andcall_extension_chain()on base Plugincall_extension(point)— collect results from all implementerscall_extension_chain(point, ctx)— flow ctx through implementers (like old hooks)get_implementations()+ iteration boilerplateAuto-injected registry
start_all()setsplugin._registry = selfon every pluginset_registry()methods andget_registry()callsself._registryandself.call_extension()immediatelyPorted plugins
implements: {"loop.on_message": "log_message_received", ...}on_message_received,transform_history,on_after_sendimplementstransform_historyimplementson_message_receivedimplementson_message_receivedimplementson_before_llm_call,on_after_llm_callimplementson_before_llm_callimplementsDeprecated
run_hook()in registry (stub, prints warning)HOOK_METHODSlist (kept as reference, now lists extension point names)run()convenience function removed from__init__.pyStats
9a51d1c42db7c7346babb7c7346bab0b4922abb5d35a21381d19da7d83f9LGTM