feat: add plugin system with events and hooks#127
Open
steven1522 wants to merge 3 commits intoTinyAGI:mainfrom
Open
feat: add plugin system with events and hooks#127steven1522 wants to merge 3 commits intoTinyAGI:mainfrom
steven1522 wants to merge 3 commits intoTinyAGI:mainfrom
Conversation
Plugin System: - Add src/lib/plugins.ts - auto-discovers plugins from .tinyclaw/plugins/ - Events broadcast to plugin handlers for visualization (3D avatar, etc.) - Hooks transform incoming/outgoing messages per channel - Metadata support (e.g., Telegram MarkdownV2 parseMode) Bug Fixes (found during testing): - Remove message truncation - let channel clients chunk long messages - Strip CLAUDECODE env var so CLI works inside Claude Code sessions Files changed: - src/lib/plugins.ts (new) - src/lib/logging.ts, types.ts, queue-processor.ts (plugin integration) - src/channels/telegram-client.ts (metadata/parseMode support) - src/lib/invoke.ts (CLAUDECODE fix) - .agents/.../send_message.ts (remove truncation) - .gitignore (expanded patterns)
Prevents messages from getting stuck in an infinite retry loop when Telegram rejects malformed MarkdownV2. On failure, retries without parse_mode so the message still gets delivered.
Collaborator
|
@codex review this PR for adding plugin system |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Re-queuing orphaned files caused infinite restart loops when the agent triggered a tinyclaw restart — the same message would get recovered and processed again, triggering another restart. Now orphaned files are simply deleted on startup.
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
Add a lightweight plugin system to TinyClaw that enables:
**bold**to channel-specific formatting)Plugins auto-discover from
.tinyclaw/plugins/folder.Changes
Plugin System (new)
src/lib/plugins.ts- Core plugin loader, event broadcasting, and hook runneractivate(ctx)function and/orhooksobject fromindex.tsemitEvent()is calledparseMode: 'MarkdownV2'for Telegram)Integration
src/lib/logging.ts- Broadcasts events to plugin handlerssrc/queue-processor.ts- Loads plugins at startup, runs incoming/outgoing hookssrc/channels/telegram-client.ts- Supportsmetadata.parseModefor rich formattingsrc/lib/types.ts- Addedmetadatafield toResponseDataBug Fixes (found during testing)
src/lib/invoke.ts- StripCLAUDECODEenv var so CLI works inside Claude Code sessions.agents/.../send_message.ts- Remove message truncation, let channel clients chunksrc/queue-processor.ts- RemovehandleLongResponse()truncationOther
.gitignore- Expanded patterns for runtime files, secrets, pluginsPlugin API
Test Plan