Skip to content

Comments

fix: replace require() with ESM import in discovery cache#204

Open
haosenwang1018 wants to merge 1 commit intoConway-Research:mainfrom
haosenwang1018:fix/discovery-require-in-esm
Open

fix: replace require() with ESM import in discovery cache#204
haosenwang1018 wants to merge 1 commit intoConway-Research:mainfrom
haosenwang1018:fix/discovery-require-in-esm

Conversation

@haosenwang1018
Copy link
Contributor

Summary

  • setCachedCard() in src/registry/discovery.ts used require("viem") to get keccak256 and toBytes
  • Since the project uses "type": "module", require() is not defined at runtime and this crashes when the discovery cache tries to store an agent card
  • Moved the import to the existing top-level ESM imports where other viem utilities are already imported

Test plan

  • npx tsc --noEmit passes
  • Verify discovery cache works at runtime (call discoverAgents() with a database)

🤖 Generated with Claude Code

setCachedCard() used require("viem") to get keccak256 and toBytes,
which crashes at runtime since the project uses "type": "module".
Move the import to the top-level ESM import that already exists for
other viem utilities.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
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.

1 participant