Skip to content

Conversation

@ian
Copy link
Owner

@ian ian commented Oct 6, 2025

  • feat(core): add isFromSelf() and isFrom() filter methods for HYBRID-57
  • perf(core): reuse AddressResolver instance across isFrom() calls
  • feat(core,xmtp): add sender and subjects to runtime (HYBRID-59)
  • refactor(xmtp): use unified Resolver class instead of individual resolvers
  • cleanup
  • cleanup
  • fighting casts
  • wip

Summary by cubic

Adds sender and subjects to the Agent runtime and introduces new message filters (isFromSelf and async isFrom) for address-aware behaviors. Refactors XMTP integration with a unified resolver and caching for more reliable, faster address/name resolution, aligning with HYBRID-59 and supporting HYBRID-57.

  • New Features

    • Populates runtime.sender and runtime.subjects for text, reply, and reaction events using a unified Resolver.
    • Adds filter.isFromSelf() (alias) and async filter.isFrom(address); filterMessages now supports async predicates.
    • README updated with new filters and async usage; comprehensive tests added.
  • Refactors

    • Replaces individual resolvers with a single Resolver; reuses AddressResolver and adds retry/sync on identity lookups.
    • Reorders handlers to honor behavior chain stops and skip responses when filtered.
    • Exposes Resolver and AddressResolver; re-exports createSigner/createUser from @xmtp/agent-sdk/user.
    • Bumps @xmtp/agent-sdk to ^1.1.4 and @xmtp/node-sdk to ^4.2.2; removes subjects.ts.

devin-ai-integration bot and others added 9 commits October 5, 2025 23:34
- Add isFromSelf() method to FilterAPI as alias for fromSelf()
- Add async isFrom(address) method to filter by Ethereum address
- Update filterMessages to support both sync and async filter callbacks
- Implement address resolution using AddressResolver with caching
- Add comprehensive test coverage for both new methods
- Export AddressResolver from @hybrd/xmtp package
- Update README with new filter methods and async usage example
Move AddressResolver instantiation outside filterAPI to enable cache reuse
across multiple isFrom() filter calls within the same context, improving
performance as recommended by code review.
- Uncommented sender and subjects fields in AgentRuntime interface
- Added resolveSender() helper function in XMTP plugin to resolve sender addresses
- Integrated address resolution using AddressResolver and BasenameResolver
- Added subjects extraction from message content using extractSubjects()
- Updated all 4 message handler locations to populate runtime.sender and runtime.subjects
- Simplified isFrom() filter to use runtime.sender.address directly
- Updated tests to mock runtime.sender and runtime.subjects
- Removed redundant AddressResolver instantiation from filter-messages behavior

This resolves the performance concern by resolving addresses once at
the runtime level rather than repeatedly in filter methods.

Fixes HYBRID-59
Relates to HYBRID-57
Resolved merge conflict in packages/xmtp/src/plugin.ts by accepting
origin/main's restructured event handler architecture which already
includes the HYBRID-59 sender/subjects resolution logic.
…lvers

- Replace individual resolver imports with top-level Resolver class
- Remove custom resolveSender() function, use Resolver.createXmtpSender()
- Update extractSubjects() to accept Resolver instance
- Use Resolver.resolveName() for universal name resolution
- Create single Resolver instance shared across all event handlers
- Fix test mock to include required senderInboxId field

Addresses code review feedback from Ian on PR #88
@linear
Copy link

linear bot commented Oct 6, 2025

@cloudflare-workers-and-pages
Copy link

Deploying hybrid with  Cloudflare Pages  Cloudflare Pages

Latest commit: d8ac202
Status: ✅  Deploy successful!
Preview URL: https://8e3dd1c7.hybrid-2zz.pages.dev
Branch Preview URL: https://hybrid-59-add-sender-and-sub.hybrid-2zz.pages.dev

View logs

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.

2 participants