Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: character file plugins import error #2025

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

mbcse
Copy link
Contributor

@mbcse mbcse commented Jan 8, 2025

Fix for Plugin Import Issues through Character file

Relates to

Risks

  • Low risk - Changes only affect plugin import behavior
  • Impacts community-published plugins without default exports
  • No changes to core functionality or existing working plugins

Background

What does this PR do?

It was noticed while adding plugins to the character file, many plugins would fail and the agent would crash. This happened because the code is written to get default exports and many plugins are not doing so. They named exports, which caused the imported plugin to be undefined! Also, an issue is that if the plugin is mentioned in the character file and is already imported in the agent's code, it creates two plugin instances. I have also fixed that by adding a check and filtering duplicates in such cases in agent runtime code.

Type of Change

Bug fix - Resolves dynamic plugin import failures

Documentation Impact

No changes are needed to project documentation as this fixes implementation details without changing the public API.

Testing

Where to start?

  1. Start with adding a plugin in the character file
  2. Focus on the plugin import logic changes
  3. Check error handling improvements

Testing Steps

  1. Test with a plugin using the default export

    • Import should work as before
    • Verify plugin loads correctly
  2. Test with community plugin (no default export)

    • Create a test plugin with named exports
    • Verify all valid plugins are imported
    • Check console logs for proper import tracking
  3. Test with invalid plugin

    • Verify graceful error handling

Discord Username

bchief#0

Looking forward to your review! Please let me know if you need any clarification.

@monilpat monilpat enabled auto-merge January 9, 2025 23:19
monilpat
monilpat previously approved these changes Jan 9, 2025
Copy link
Collaborator

@monilpat monilpat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@monilpat
Copy link
Collaborator

monilpat commented Jan 9, 2025

(After merge conflicts)

@monilpat monilpat disabled auto-merge January 9, 2025 23:20
@mbcse
Copy link
Contributor Author

mbcse commented Jan 10, 2025

(After merge conflicts)

Fixed @monilpat. You can merge now!

agent/src/index.ts Outdated Show resolved Hide resolved
agent/src/index.ts Show resolved Hide resolved
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.

4 participants