Skip to content

Implement plugin system with callback registry and extended IRC API - #10

Merged
nanonyme merged 4 commits into
mainfrom
copilot/design-internal-api
Feb 19, 2026
Merged

nanonyme merged 4 commits into
mainfrom
copilot/design-internal-api

Conversation

Copilot AI commented Feb 19, 2026 •

Copy link
Copy Markdown
Contributor

Adds a plugin system allowing extensibility without core modifications. Plugins register callbacks for IRC events processed directly at the protocol layer, avoiding the PB wire overhead for all messages.

Core Plugin System

  • PluginRegistry: Manages plugin lifecycle and event handler multiplexing
  • Plugin base class: Abstract interface with load() method for handler registration
  • Configuration-driven loading: Plugins specified in config.json with per-plugin settings
class MyPlugin(Plugin):
    def load(self):
        self.register_handler('privmsg', self.on_message)
    
    def on_message(self, protocol, user, channel, message):
        if 'hello' in message.lower():
            protocol.msg(channel, "Hi!")

def load(registry, config):
    plugin = MyPlugin('my_plugin', registry, config.get('config', {}))
    plugin.load()
    return plugin

Extended RemoteProtocol API

Added IRC control methods: topic, mode, kick, invite, quit, describe, notice, away, back. Enables full protocol manipulation from plugins without core changes.

Event Dispatching

NanoBotProtocol now dispatches 9 IRC events: signed_on, privmsg, user_joined, user_left, user_quit, user_kicked, action, topic_updated, user_renamed. Multiple handlers per event supported with error isolation.

Implementation Notes

  • Backward compatible: no plugins configured = existing behavior unchanged
  • Handler exceptions isolated: one plugin failure doesn't cascade
  • Example plugin in plugins/example_plugin.py demonstrates patterns
Original prompt

This section details on the original issue you should resolve

<issue_title>Design internal API</issue_title>
<issue_description>I think what we should have is some plugin callback registry. Plugins have load function that results in plugin registering for callbacks it wants to process. On load core will determine from config which plugins should be loaded. </issue_description>

Comments on the Issue (you are @copilot in this section)

@nanonyme There's currently a really simplistic API. Based on a chat with fbs it should probably be redesigned somewhat. Some ideas: - Registering event handlers for IRCClient instances so not all messages need to be sent over the wire to app - More complete RemoteProtocol that allows full control of the protocol from app side

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 19, 2026 11:24
Co-authored-by: nanonyme <348449+nanonyme@users.noreply.github.com>
… API

Co-authored-by: nanonyme <348449+nanonyme@users.noreply.github.com>
Co-authored-by: nanonyme <348449+nanonyme@users.noreply.github.com>
Copilot AI changed the title [WIP] Redesign internal API for plugin callback registry Implement plugin system with callback registry and extended IRC API Feb 19, 2026
Copilot AI requested a review from nanonyme February 19, 2026 11:29
@nanonyme
nanonyme marked this pull request as ready for review February 19, 2026 11:45
@nanonyme
nanonyme merged commit bbbb82e into main Feb 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Design internal API

2 participants