feat: add plugin command API for LLM-free auto-reply commands#1558
Merged
steipete merged 4 commits intoopenclaw:mainfrom Jan 24, 2026
Merged
feat: add plugin command API for LLM-free auto-reply commands#1558steipete merged 4 commits intoopenclaw:mainfrom
steipete merged 4 commits intoopenclaw:mainfrom
Conversation
This adds a new `api.registerCommand()` method to the plugin API, allowing plugins to register slash commands that execute without invoking the AI agent. Features: - Plugin commands are processed before built-in commands and the agent - Commands can optionally require authorization - Commands can accept arguments - Async handlers are supported Use case: plugins can implement toggle commands (like /tts_on, /tts_off) that respond immediately without consuming LLM API calls. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Blockers fixed: - Fix documentation: requireAuth defaults to true (not false) - Add command name validation (must start with letter, alphanumeric only) - Add reserved commands list to prevent shadowing built-in commands - Emit diagnostic errors for invalid/duplicate command registration Other improvements: - Return user-friendly message for unauthorized commands (instead of silence) - Sanitize error messages to avoid leaking internal details - Document acceptsArgs behavior when arguments are provided - Add notes about reserved commands and validation rules to docs Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add clearPluginCommands() call in loadClawdbotPlugins() to ensure previously registered commands are cleaned up before reloading plugins. This prevents command conflicts during hot-reload scenarios. Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add registry lock during command execution to prevent race conditions - Add input sanitization for command arguments (defense in depth) - Validate handler is a function during registration - Remove redundant case-insensitive regex flag - Add success logging for command execution - Simplify handler return type (always returns result now) - Remove dead code branch in commands-plugin.ts Co-Authored-By: Claude Opus 4.5 <[email protected]>
4 tasks
steipete
added a commit
that referenced
this pull request
Jan 24, 2026
steipete
added a commit
that referenced
this pull request
Jan 24, 2026
steipete
added a commit
that referenced
this pull request
Jan 24, 2026
steipete
added a commit
that referenced
this pull request
Jan 24, 2026
steipete
added a commit
that referenced
this pull request
Jan 24, 2026
steipete
added a commit
that referenced
this pull request
Jan 24, 2026
Contributor
|
Landed via temp rebase onto main.\n\n- Gate: pnpm lint && pnpm build && pnpm test\n- Land commit: 6bd6ae4\n- Merge commit: 6bd6ae4\n\nThanks @Glucksberg! |
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
Key features:
registerCommand()API for plugins to register commandsFiles changed:
src/plugins/commands.ts- Core command registration and executionsrc/plugins/types.ts- TypeScript types for command definitionssrc/plugins/registry.ts- Integration with plugin registrysrc/plugins/runtime.ts- Runtime API exposuresrc/plugins/loader.ts- Command cleanup on plugin reloadsrc/auto-reply/reply/commands-plugin.ts- Command handler in auto-reply chainsrc/auto-reply/reply/commands-core.ts- Integration with core command handlerdocs/plugin.md- Documentation for the new APITest plan
pnpm testto verify all tests pass🤖 Generated with Claude Code