diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 086bfe3c77..d640179b54 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -35,7 +35,7 @@ jobs:
run: sudo apt-get install -y protobuf-compiler
- name: Install dependencies
- run: pnpm install
+ run: pnpm install -r --no-frozen-lockfile
- name: Build packages
run: pnpm run build
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9a4af4e5f6..4646b5f74a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,160 @@
# Changelog
+## [v0.1.7](https://github.com/elizaOS/eliza/tree/v0.1.7) (2025-01-04)
+
+[Full Changelog](https://github.com/elizaOS/eliza/compare/v0.1.7-alpha.2...v0.1.7)
+
+**Implemented enhancements:**
+
+- Implement Caching for API Responses [\#1794](https://github.com/elizaOS/eliza/issues/1794)
+- Implement Caching for API Responses [\#1792](https://github.com/elizaOS/eliza/issues/1792)
+- Implement Caching for API Responses [\#1791](https://github.com/elizaOS/eliza/issues/1791)
+- Implement Caching for API Responses [\#1789](https://github.com/elizaOS/eliza/issues/1789)
+- Feature Request: Implement Enhanced Error Logging for API Calls [\#1736](https://github.com/elizaOS/eliza/issues/1736)
+- Implement feature for issue \#1725 on repository elizaOS/eliza branch develop [\#1734](https://github.com/elizaOS/eliza/issues/1734)
+- Enhance API Documentation [\#1732](https://github.com/elizaOS/eliza/issues/1732)
+- Implement feature for issue \#1725 [\#1731](https://github.com/elizaOS/eliza/issues/1731)
+- Implement feature for issue \#1725 [\#1730](https://github.com/elizaOS/eliza/issues/1730)
+- Enhance API Documentation [\#1729](https://github.com/elizaOS/eliza/issues/1729)
+- Implement a Caching Mechanism for API Responses [\#1726](https://github.com/elizaOS/eliza/issues/1726)
+- Implement a Structured Logging Framework [\#1724](https://github.com/elizaOS/eliza/issues/1724)
+- Add support for Coinbase Commerce integration [\#1723](https://github.com/elizaOS/eliza/issues/1723)
+- Serve docusaurus docs from a docker container for quick docs verification [\#1720](https://github.com/elizaOS/eliza/issues/1720)
+- Use Caret \(^\) for Dependency Versions in package.json [\#1662](https://github.com/elizaOS/eliza/issues/1662)
+- Deduplicate dependencies across plugins and move shared dependencies to the root package.json [\#1658](https://github.com/elizaOS/eliza/issues/1658)
+- Deduplicate Dependencies Across Plugins [\#1656](https://github.com/elizaOS/eliza/issues/1656)
+- Deduplicate Dependencies Across Plugins [\#1652](https://github.com/elizaOS/eliza/issues/1652)
+- Deduplicate Dependencies Across Plugins [\#1650](https://github.com/elizaOS/eliza/issues/1650)
+- Viem version too old to include Arthera EVM chain [\#1635](https://github.com/elizaOS/eliza/issues/1635)
+- Add Spanish Translation for Documentation README \(docs/README\_es.md\) [\#1592](https://github.com/elizaOS/eliza/issues/1592)
+- Expand Support for Non-OpenAI Models in Token Trimming [\#1565](https://github.com/elizaOS/eliza/issues/1565)
+- spades [\#1563](https://github.com/elizaOS/eliza/issues/1563)
+- Support better in-monorepo navigation with custom conditions [\#1363](https://github.com/elizaOS/eliza/issues/1363)
+- Add Livepeer as an Image Generation Provider [\#1271](https://github.com/elizaOS/eliza/issues/1271)
+- Arbitrum Integration [\#851](https://github.com/elizaOS/eliza/issues/851)
+- Twitter Spaces Voice Client [\#301](https://github.com/elizaOS/eliza/issues/301)
+- 🐛 fix plugins.md formatting for docs with dockerized docs validation [\#1722](https://github.com/elizaOS/eliza/pull/1722) ([marcellodesales](https://github.com/marcellodesales))
+
+**Fixed bugs:**
+
+- Fix: Standardize ACTION\_INTERVAL unit to minutes in Twitter client [\#1788](https://github.com/elizaOS/eliza/issues/1788)
+- pdf js crashes the agent [\#1751](https://github.com/elizaOS/eliza/issues/1751)
+- Failed to run on Macbook M1 [\#1742](https://github.com/elizaOS/eliza/issues/1742)
+- Issue Created: http proxy error: /e0e10e6f-ff2b-0d4c-8011-1fc1eee7cb32/message [\#1733](https://github.com/elizaOS/eliza/issues/1733)
+- can't build framework - followed quick start - pnpm build error [\#1714](https://github.com/elizaOS/eliza/issues/1714)
+- Google Model Not Working [\#1709](https://github.com/elizaOS/eliza/issues/1709)
+- failed: @elizaos/plugin-echochambers\#build [\#1691](https://github.com/elizaOS/eliza/issues/1691)
+- initial setup not working. help needed please. [\#1666](https://github.com/elizaOS/eliza/issues/1666)
+- ImageDescriptionService [\#1643](https://github.com/elizaOS/eliza/issues/1643)
+- Dockerfile errors when building image [\#1623](https://github.com/elizaOS/eliza/issues/1623)
+- Initial setup based on docs not working [\#1622](https://github.com/elizaOS/eliza/issues/1622)
+- Running Eliza with LLAMALOCAL fails after first query [\#1575](https://github.com/elizaOS/eliza/issues/1575)
+- Quick start guide bug - pnpm start [\#1552](https://github.com/elizaOS/eliza/issues/1552)
+- callback throws - \["⛔ TypeError: callback is not a function"\] - when action is called from the Twitter Client [\#1544](https://github.com/elizaOS/eliza/issues/1544)
+- Bug: generateText is ignoring dynamic parameters due to a hard-coded model class [\#1439](https://github.com/elizaOS/eliza/issues/1439)
+- fix: Slack client Media type implementation missing required properties in message attachments [\#1384](https://github.com/elizaOS/eliza/issues/1384)
+- Error when trying deploy using dockerfile [\#1168](https://github.com/elizaOS/eliza/issues/1168)
+
+**Closed issues:**
+
+- Pull Request Created: Simulate discord typing while generating a response [\#1786](https://github.com/elizaOS/eliza/issues/1786)
+- Fix Public Solana Wallet Not Found! [\#1781](https://github.com/elizaOS/eliza/issues/1781)
+- \ [\#1692](https://github.com/elizaOS/eliza/issues/1692)
+
+**Merged pull requests:**
+
+- chore: bump version to v.0.1.7 [\#1804](https://github.com/elizaOS/eliza/pull/1804) ([shakkernerd](https://github.com/shakkernerd))
+- fix: generation tests for trimTokens [\#1803](https://github.com/elizaOS/eliza/pull/1803) ([shakkernerd](https://github.com/shakkernerd))
+- chore: install with no frozen-lockfile flag [\#1802](https://github.com/elizaOS/eliza/pull/1802) ([shakkernerd](https://github.com/shakkernerd))
+- Revert "fix\(postgres\): Handle vector extension creation properly \(\#1561\)" [\#1799](https://github.com/elizaOS/eliza/pull/1799) ([shakkernerd](https://github.com/shakkernerd))
+- chore: remove unused import and var [\#1797](https://github.com/elizaOS/eliza/pull/1797) ([shakkernerd](https://github.com/shakkernerd))
+- bug : Removed FerePro plugin [\#1795](https://github.com/elizaOS/eliza/pull/1795) ([Rudrakc](https://github.com/Rudrakc))
+- fix: line break handling in chat [\#1784](https://github.com/elizaOS/eliza/pull/1784) ([swizzmagik](https://github.com/swizzmagik))
+- fix\(client\): improve Windows compatibility for Vite dev server [\#1760](https://github.com/elizaOS/eliza/pull/1760) ([gmh5225](https://github.com/gmh5225))
+- fix: build lint errors [\#1759](https://github.com/elizaOS/eliza/pull/1759) ([shakkernerd](https://github.com/shakkernerd))
+- docs: add Serbian README translation [\#1757](https://github.com/elizaOS/eliza/pull/1757) ([marsic3](https://github.com/marsic3))
+- docs: update faq.md [\#1746](https://github.com/elizaOS/eliza/pull/1746) ([TresFlames](https://github.com/TresFlames))
+- feat\(plugin-near\): replace console.log to eliza logger [\#1745](https://github.com/elizaOS/eliza/pull/1745) ([sinecose](https://github.com/sinecose))
+- fix\(postgres\): Handle vector extension creation properly \(\#1561\) [\#1743](https://github.com/elizaOS/eliza/pull/1743) ([AIFlowML](https://github.com/AIFlowML))
+- fix\(client-slack\): implement Media type properties in message attachments \#1384 [\#1741](https://github.com/elizaOS/eliza/pull/1741) ([AIFlowML](https://github.com/AIFlowML))
+- feat: support for eternalai provider can write request/response log info [\#1740](https://github.com/elizaOS/eliza/pull/1740) ([genesis-0000](https://github.com/genesis-0000))
+- docs: update README\_KOR.md [\#1739](https://github.com/elizaOS/eliza/pull/1739) ([osrm](https://github.com/osrm))
+- fix: standardize ACTION\_INTERVAL unit to minutes in twitter client [\#1738](https://github.com/elizaOS/eliza/pull/1738) ([sin-bufan](https://github.com/sin-bufan))
+- fix: add echochambers to agent [\#1719](https://github.com/elizaOS/eliza/pull/1719) ([odilitime](https://github.com/odilitime))
+- fix: multiple web search import in agent [\#1718](https://github.com/elizaOS/eliza/pull/1718) ([shakkernerd](https://github.com/shakkernerd))
+- chore: Develop =\> main for 1.7.0 release [\#1717](https://github.com/elizaOS/eliza/pull/1717) ([odilitime](https://github.com/odilitime))
+- chore\(zksync-era\): rm not used imports [\#1716](https://github.com/elizaOS/eliza/pull/1716) ([9547](https://github.com/9547))
+- refactor: client api [\#1713](https://github.com/elizaOS/eliza/pull/1713) ([aalimsahin](https://github.com/aalimsahin))
+- feat: Simulate discord typing while generating a response [\#1712](https://github.com/elizaOS/eliza/pull/1712) ([dxlliv](https://github.com/dxlliv))
+- EVM plugin wallet provider and transfer action improvements [\#1701](https://github.com/elizaOS/eliza/pull/1701) ([nicky-ru](https://github.com/nicky-ru))
+- chore: twitter username validation message [\#1698](https://github.com/elizaOS/eliza/pull/1698) ([daizhengxue](https://github.com/daizhengxue))
+- fix: Url fix in imagedescriptionservice [\#1696](https://github.com/elizaOS/eliza/pull/1696) ([denizekiz](https://github.com/denizekiz))
+- fix: smoke tests [\#1695](https://github.com/elizaOS/eliza/pull/1695) ([shakkernerd](https://github.com/shakkernerd))
+- feat: Plugin sui support for suiprivatekey0x account [\#1693](https://github.com/elizaOS/eliza/pull/1693) ([v1xingyue](https://github.com/v1xingyue))
+- docs: update README.md spelling [\#1690](https://github.com/elizaOS/eliza/pull/1690) ([SK1989sL](https://github.com/SK1989sL))
+- chore: update web search plugin export [\#1688](https://github.com/elizaOS/eliza/pull/1688) ([affaan-m](https://github.com/affaan-m))
+- fix\(core\): trimTokens no need to await [\#1686](https://github.com/elizaOS/eliza/pull/1686) ([9547](https://github.com/9547))
+- Update README\_KOR.md: Added missing sections and improved Korean translations for clarity [\#1683](https://github.com/elizaOS/eliza/pull/1683) ([gnujoow](https://github.com/gnujoow))
+- chore\(docs\): rename ai16z/eliza to elizaOS/eliza [\#1679](https://github.com/elizaOS/eliza/pull/1679) ([9547](https://github.com/9547))
+- fix: add web search to agent [\#1676](https://github.com/elizaOS/eliza/pull/1676) ([odilitime](https://github.com/odilitime))
+- Agentic Eliza Plugin Documenter - Multilingual \(e.g., English, Spanish, French\) [\#1675](https://github.com/elizaOS/eliza/pull/1675) ([Ed-Marcavage](https://github.com/Ed-Marcavage))
+- feat: add docs for story plugin [\#1672](https://github.com/elizaOS/eliza/pull/1672) ([chandiniv1](https://github.com/chandiniv1))
+- fix: 1668 fix twitter image link [\#1671](https://github.com/elizaOS/eliza/pull/1671) ([nusk0](https://github.com/nusk0))
+- fix: 1634 fix image description service [\#1667](https://github.com/elizaOS/eliza/pull/1667) ([nusk0](https://github.com/nusk0))
+- fix: Seperated imageModelProvider and imageVisionModelProvider for ImageDescriptioServices [\#1664](https://github.com/elizaOS/eliza/pull/1664) ([denizekiz](https://github.com/denizekiz))
+- fix: Update Supabase schema.sql [\#1660](https://github.com/elizaOS/eliza/pull/1660) ([0xRider](https://github.com/0xRider))
+- fix: Fix bug in plugin-bootstrap/src/evaluators/facts.ts [\#1648](https://github.com/elizaOS/eliza/pull/1648) ([metakai1](https://github.com/metakai1))
+- Added Hungarian README [\#1645](https://github.com/elizaOS/eliza/pull/1645) ([mdominikd](https://github.com/mdominikd))
+- fix: lockfile wasn't updated after dependency + bring viem to root level package.json [\#1642](https://github.com/elizaOS/eliza/pull/1642) ([monilpat](https://github.com/monilpat))
+- chore: update viem dependency version in plugin-evm and plugin-goat [\#1637](https://github.com/elizaOS/eliza/pull/1637) ([bertux](https://github.com/bertux))
+- Add README\_AR.md [\#1634](https://github.com/elizaOS/eliza/pull/1634) ([xMariem](https://github.com/xMariem))
+- fix: corrected path for image upload [\#1632](https://github.com/elizaOS/eliza/pull/1632) ([ShreyGanatra](https://github.com/ShreyGanatra))
+- fix: turbo deps for plugin-evm [\#1627](https://github.com/elizaOS/eliza/pull/1627) ([odilitime](https://github.com/odilitime))
+- Fix double spaced tweets in Post.ts [\#1626](https://github.com/elizaOS/eliza/pull/1626) ([suicidalgoofy](https://github.com/suicidalgoofy))
+- feat: Select a transcription provider based on the character settings. [\#1625](https://github.com/elizaOS/eliza/pull/1625) ([tcm390](https://github.com/tcm390))
+- fix: bugfix. the port 80 is not listening use 3000 [\#1616](https://github.com/elizaOS/eliza/pull/1616) ([jmikedupont2](https://github.com/jmikedupont2))
+- add plugins to the key components section of the faq [\#1614](https://github.com/elizaOS/eliza/pull/1614) ([cole-gillespie](https://github.com/cole-gillespie))
+- fix: update plugin-solana workspace dependencies [\#1609](https://github.com/elizaOS/eliza/pull/1609) ([shakkernerd](https://github.com/shakkernerd))
+- fix: Google API Key not passing from character file [\#1607](https://github.com/elizaOS/eliza/pull/1607) ([azep-ninja](https://github.com/azep-ninja))
+- fix: Double Responses from Continue Action [\#1606](https://github.com/elizaOS/eliza/pull/1606) ([azep-ninja](https://github.com/azep-ninja))
+- fix: Support for Non-OpenAI Models in Token Trimming [\#1605](https://github.com/elizaOS/eliza/pull/1605) ([tcm390](https://github.com/tcm390))
+- fix: tweak transfer template of plugin-evm [\#1604](https://github.com/elizaOS/eliza/pull/1604) ([zkvm](https://github.com/zkvm))
+- feat: add experimental telemetry model option [\#1603](https://github.com/elizaOS/eliza/pull/1603) ([zhourunlai](https://github.com/zhourunlai))
+- refactor\(plugin-conflux\): output detailed invalid content [\#1602](https://github.com/elizaOS/eliza/pull/1602) ([bendanzhentan](https://github.com/bendanzhentan))
+- docs: README.md files for plugins [\#1601](https://github.com/elizaOS/eliza/pull/1601) ([ileana-pr](https://github.com/ileana-pr))
+- feat: use tavily sdk [\#1599](https://github.com/elizaOS/eliza/pull/1599) ([zhourunlai](https://github.com/zhourunlai))
+- docs: add readme spanish version in docs [\#1594](https://github.com/elizaOS/eliza/pull/1594) ([salazarsebas](https://github.com/salazarsebas))
+- feat: add docs for image generation plugin [\#1591](https://github.com/elizaOS/eliza/pull/1591) ([chandiniv1](https://github.com/chandiniv1))
+- docs: fix Contributing Guide [\#1589](https://github.com/elizaOS/eliza/pull/1589) ([0xFloyd](https://github.com/0xFloyd))
+- feat: update volcengine model [\#1586](https://github.com/elizaOS/eliza/pull/1586) ([zhourunlai](https://github.com/zhourunlai))
+- add an client-direct endpoint to get memories by agentid and roomid [\#1581](https://github.com/elizaOS/eliza/pull/1581) ([treppers](https://github.com/treppers))
+- Update agents.md - minor update [\#1579](https://github.com/elizaOS/eliza/pull/1579) ([yorkerhodes3](https://github.com/yorkerhodes3))
+- fix: activate web-search plugin in agents/ [\#1577](https://github.com/elizaOS/eliza/pull/1577) ([cmadaanaya](https://github.com/cmadaanaya))
+- docs: overview and preview of technical report [\#1574](https://github.com/elizaOS/eliza/pull/1574) ([tomguluson92](https://github.com/tomguluson92))
+- feat: parse files through prettier [\#1573](https://github.com/elizaOS/eliza/pull/1573) ([shakkernerd](https://github.com/shakkernerd))
+- fix: init 768 dimension in database for gaianet [\#1572](https://github.com/elizaOS/eliza/pull/1572) ([L-jasmine](https://github.com/L-jasmine))
+- feat: add TEE support for plugin-env [\#1571](https://github.com/elizaOS/eliza/pull/1571) ([samuveth](https://github.com/samuveth))
+- docs: Add "What Did You Get Done This Week? \#7" notes [\#1559](https://github.com/elizaOS/eliza/pull/1559) ([YoungPhlo](https://github.com/YoungPhlo))
+- feat: add theme toggle functionality with dark and light mode support [\#1555](https://github.com/elizaOS/eliza/pull/1555) ([zkfriendly](https://github.com/zkfriendly))
+- feat: \(example\) script to show how to add system prompt and templates to eliza with character file [\#1554](https://github.com/elizaOS/eliza/pull/1554) ([HashWarlock](https://github.com/HashWarlock))
+- feat: Twitter Spaces Integration [\#1550](https://github.com/elizaOS/eliza/pull/1550) ([slkzgm](https://github.com/slkzgm))
+- docs: Add JSDoc documentation [\#1549](https://github.com/elizaOS/eliza/pull/1549) ([madjin](https://github.com/madjin))
+- docs: Add JSDoc documentation [\#1548](https://github.com/elizaOS/eliza/pull/1548) ([madjin](https://github.com/madjin))
+- Fix jsdoc automation build issue & parametrize PR branch target [\#1547](https://github.com/elizaOS/eliza/pull/1547) ([Ed-Marcavage](https://github.com/Ed-Marcavage))
+- fix: Telegram Bad Request: can't parse entities [\#1546](https://github.com/elizaOS/eliza/pull/1546) ([azep-ninja](https://github.com/azep-ninja))
+- Chore: Refactor Imports. Improve PR Template [\#1545](https://github.com/elizaOS/eliza/pull/1545) ([mgunnin](https://github.com/mgunnin))
+- fix: twitter usernames can start with numbers [\#1541](https://github.com/elizaOS/eliza/pull/1541) ([odilitime](https://github.com/odilitime))
+- feat: improve stale pr/issue messages [\#1540](https://github.com/elizaOS/eliza/pull/1540) ([monilpat](https://github.com/monilpat))
+- feat: add autoscroll chat client [\#1538](https://github.com/elizaOS/eliza/pull/1538) ([swizzmagik](https://github.com/swizzmagik))
+- docs: Polish readme [\#1537](https://github.com/elizaOS/eliza/pull/1537) ([yanushevitz](https://github.com/yanushevitz))
+- fix: disable trust provider for PostGres db [\#1536](https://github.com/elizaOS/eliza/pull/1536) ([swizzmagik](https://github.com/swizzmagik))
+- Update README\_CN - Model Configuration [\#1535](https://github.com/elizaOS/eliza/pull/1535) ([RedHorse823](https://github.com/RedHorse823))
+- docs: fix grammar/typos in README [\#1534](https://github.com/elizaOS/eliza/pull/1534) ([SK1989sL](https://github.com/SK1989sL))
+- Fix: make twitter engagement criteria in prompt more focused on relevance to topics/interests/character [\#1533](https://github.com/elizaOS/eliza/pull/1533) ([e-fu](https://github.com/e-fu))
+- feat: improve GOAT integration by allowing tool calling when using generateText [\#1403](https://github.com/elizaOS/eliza/pull/1403) ([0xaguspunk](https://github.com/0xaguspunk))
+- fix: postgres-adapter - remove nonsensical schema check [\#1377](https://github.com/elizaOS/eliza/pull/1377) ([ryanleecode](https://github.com/ryanleecode))
+- feat: use custom conditions for live monorepo types [\#1365](https://github.com/elizaOS/eliza/pull/1365) ([ryanleecode](https://github.com/ryanleecode))
+
## [v0.1.7-alpha.2](https://github.com/elizaOS/eliza/tree/v0.1.7-alpha.2) (2024-12-28)
[Full Changelog](https://github.com/elizaOS/eliza/compare/v0.1.7-alpha.1...v0.1.7-alpha.2)
@@ -1363,4 +1518,4 @@
-\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
\ No newline at end of file
+\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
diff --git a/packages/client-telegram/src/messageManager.ts b/packages/client-telegram/src/messageManager.ts
index bbf597232d..c1e96cbc4e 100644
--- a/packages/client-telegram/src/messageManager.ts
+++ b/packages/client-telegram/src/messageManager.ts
@@ -1,6 +1,7 @@
import { Message } from "@telegraf/types";
import { Context, Telegraf } from "telegraf";
-import { composeContext, elizaLogger, ServiceType, composeRandomUser } from "@elizaos/core";
+
+import { composeContext, elizaLogger, ServiceType } from "@elizaos/core";
import { getEmbeddingZeroVector } from "@elizaos/core";
import {
Content,
@@ -18,7 +19,7 @@ import { stringToUuid } from "@elizaos/core";
import { generateMessageResponse, generateShouldRespond } from "@elizaos/core";
import { messageCompletionFooter, shouldRespondFooter } from "@elizaos/core";
-import { cosineSimilarity, escapeMarkdown } from "./utils";
+import { cosineSimilarity } from "./utils";
import {
MESSAGE_CONSTANTS,
TIMING_CONSTANTS,
@@ -296,8 +297,8 @@ export class MessageManager {
"text" in message
? message.text
: "caption" in message
- ? (message as any).caption
- : "";
+ ? (message as any).caption
+ : "";
if (!messageText) return false;
@@ -359,8 +360,8 @@ export class MessageManager {
"text" in message
? message.text
: "caption" in message
- ? (message as any).caption
- : "";
+ ? (message as any).caption
+ : "";
if (!messageText) return false;
const isReplyToBot =
@@ -375,7 +376,7 @@ export class MessageManager {
isReplyToBot ||
isMentioned ||
(!this.runtime.character.clientConfig?.telegram
- ?.shouldRespondOnlyToMentions &&
+ ?.shouldRespondOnlyToMentions &&
hasUsername)
);
}
@@ -507,8 +508,8 @@ export class MessageManager {
"text" in message
? message.text
: "caption" in message
- ? (message as any).caption
- : "";
+ ? (message as any).caption
+ : "";
// Check if team member has direct interest first
if (
@@ -529,8 +530,8 @@ export class MessageManager {
const randomDelay =
Math.floor(
Math.random() *
- (TIMING_CONSTANTS.TEAM_MEMBER_DELAY_MAX -
- TIMING_CONSTANTS.TEAM_MEMBER_DELAY_MIN)
+ (TIMING_CONSTANTS.TEAM_MEMBER_DELAY_MAX -
+ TIMING_CONSTANTS.TEAM_MEMBER_DELAY_MIN)
) + TIMING_CONSTANTS.TEAM_MEMBER_DELAY_MIN; // 1-3 second random delay
await new Promise((resolve) =>
setTimeout(resolve, randomDelay)
@@ -556,8 +557,8 @@ export class MessageManager {
const leaderResponded = recentMessages.some(
(m) =>
m.userId ===
- this.runtime.character.clientConfig?.telegram
- ?.teamLeaderId &&
+ this.runtime.character.clientConfig?.telegram
+ ?.teamLeaderId &&
Date.now() - chatState.lastMessageSent < 3000
);
@@ -578,8 +579,8 @@ export class MessageManager {
const randomDelay =
Math.floor(
Math.random() *
- (TIMING_CONSTANTS.LEADER_DELAY_MAX -
- TIMING_CONSTANTS.LEADER_DELAY_MIN)
+ (TIMING_CONSTANTS.LEADER_DELAY_MAX -
+ TIMING_CONSTANTS.LEADER_DELAY_MIN)
) + TIMING_CONSTANTS.LEADER_DELAY_MIN; // 2-4 second random delay
await new Promise((resolve) =>
setTimeout(resolve, randomDelay)
@@ -617,7 +618,7 @@ export class MessageManager {
if (chatState?.currentHandler) {
if (
chatState.currentHandler !==
- this.bot.botInfo?.id.toString() &&
+ this.bot.botInfo?.id.toString() &&
this._isTeamMember(chatState.currentHandler)
) {
return false;
@@ -628,7 +629,7 @@ export class MessageManager {
if (!this._isMessageForMe(message) && this.interestChats[chatId]) {
const recentMessages = this.interestChats[
chatId
- ].messages.slice(-MESSAGE_CONSTANTS.CHAT_HISTORY_COUNT);
+ ].messages.slice(-MESSAGE_CONSTANTS.CHAT_HISTORY_COUNT);
const ourMessageCount = recentMessages.filter(
(m) => m.userId === this.runtime.agentId
).length;
@@ -660,7 +661,7 @@ export class MessageManager {
this.runtime.character.templates
?.telegramShouldRespondTemplate ||
this.runtime.character?.templates?.shouldRespondTemplate ||
- composeRandomUser(telegramShouldRespondTemplate, 2),
+ telegramShouldRespondTemplate,
});
const response = await generateShouldRespond({
@@ -684,7 +685,17 @@ export class MessageManager {
if (content.attachments && content.attachments.length > 0) {
content.attachments.map(async (attachment: Media) => {
if (attachment.contentType.startsWith("image")) {
- this.sendImage(ctx, attachment.url, attachment.description);
+ await this.sendImage(ctx, attachment.url, attachment.description);
+ } else if (attachment.contentType.startsWith("doc")) {
+ await this.sendDocument(
+ ctx,
+ attachment.url,
+ attachment.description
+ );
+ } else if (attachment.contentType.startsWith("video")) {
+ await this.sendVideo(ctx, attachment.url, attachment.description);
+ } else if (attachment.contentType.startsWith("audio")) {
+ await this.sendAudio(ctx, attachment.url, attachment.description);
}
});
} else {
@@ -692,7 +703,7 @@ export class MessageManager {
const sentMessages: Message.TextMessage[] = [];
for (let i = 0; i < chunks.length; i++) {
- const chunk = escapeMarkdown(chunks[i]);
+ const chunk = chunks[i];
const sentMessage = (await ctx.telegram.sendMessage(
ctx.chat.id,
chunk,
@@ -712,42 +723,84 @@ export class MessageManager {
}
}
- private async sendImage(
+ private async sendMedia(
ctx: Context,
- imagePath: string,
+ mediaPath: string,
+ type: "photo" | "video" | "document" | "audio",
caption?: string
): Promise {
try {
- if (/^(http|https):\/\//.test(imagePath)) {
+ const isUrl = /^(http|https):\/\//.test(mediaPath);
+ const sendFunctionMap = {
+ photo: ctx.telegram.sendPhoto.bind(ctx.telegram),
+ video: ctx.telegram.sendVideo.bind(ctx.telegram),
+ document: ctx.telegram.sendDocument.bind(ctx.telegram),
+ audio: ctx.telegram.sendAudio.bind(ctx.telegram),
+ };
+
+ if (!sendFunctionMap[type]) {
+ throw new Error(`Unsupported media type: ${type}`);
+ }
+
+ const sendFunction = sendFunctionMap[type];
+
+ if (isUrl) {
// Handle HTTP URLs
- await ctx.telegram.sendPhoto(ctx.chat.id, imagePath, {
- caption,
- });
+ await sendFunction(ctx.chat.id, mediaPath, { caption });
} else {
// Handle local file paths
- if (!fs.existsSync(imagePath)) {
- throw new Error(`File not found: ${imagePath}`);
+ if (!fs.existsSync(mediaPath)) {
+ throw new Error(`File not found: ${mediaPath}`);
}
- const fileStream = fs.createReadStream(imagePath);
-
- await ctx.telegram.sendPhoto(
+ const fileStream = fs.createReadStream(mediaPath);
+ await sendFunction(
ctx.chat.id,
- {
- source: fileStream,
- },
- {
- caption,
- }
+ { source: fileStream },
+ { caption }
);
}
- elizaLogger.info(`Image sent successfully: ${imagePath}`);
+ elizaLogger.info(
+ `${type.charAt(0).toUpperCase() + type.slice(1)} sent successfully: ${mediaPath}`
+ );
} catch (error) {
- elizaLogger.error("Error sending image:", error);
+ elizaLogger.error(`Error sending ${type}:`, error);
}
}
+ private async sendImage(
+ ctx: Context,
+ imagePath: string,
+ caption?: string
+ ): Promise {
+ await this.sendMedia(ctx, imagePath, "photo", caption);
+ }
+
+ private async sendVideo(
+ ctx: Context,
+ videoPath: string,
+ caption?: string
+ ): Promise {
+ await this.sendMedia(ctx, videoPath, "video", caption);
+ }
+
+ private async sendDocument(
+ ctx: Context,
+ documentPath: string,
+ caption?: string
+ ): Promise {
+ await this.sendMedia(ctx, documentPath, "document", caption);
+ }
+
+ private async sendAudio(
+ ctx: Context,
+ audioPath: string,
+ caption?: string
+ ): Promise {
+ await this.sendMedia(ctx, audioPath, "audio", caption);
+ }
+
// Split message into smaller parts
private splitMessage(text: string): string[] {
const chunks: string[] = [];
@@ -823,8 +876,8 @@ export class MessageManager {
"text" in message
? message.text
: "caption" in message
- ? (message as any).caption
- : "";
+ ? (message as any).caption
+ : "";
// Add team handling at the start
if (
@@ -914,7 +967,7 @@ export class MessageManager {
if (
hasInterest ||
this.interestChats[chatId]?.currentHandler ===
- this.bot.botInfo?.id.toString()
+ this.bot.botInfo?.id.toString()
) {
delete this.interestChats[chatId];
@@ -953,7 +1006,7 @@ export class MessageManager {
) {
this.interestChats[chatId].messages = this.interestChats[
chatId
- ].messages.slice(-MESSAGE_CONSTANTS.MAX_MESSAGES);
+ ].messages.slice(-MESSAGE_CONSTANTS.MAX_MESSAGES);
}
}
}
@@ -1018,10 +1071,10 @@ export class MessageManager {
inReplyTo:
"reply_to_message" in message && message.reply_to_message
? stringToUuid(
- message.reply_to_message.message_id.toString() +
- "-" +
- this.runtime.agentId
- )
+ message.reply_to_message.message_id.toString() +
+ "-" +
+ this.runtime.agentId
+ )
: undefined,
};
@@ -1084,8 +1137,8 @@ export class MessageManager {
const memory: Memory = {
id: stringToUuid(
sentMessage.message_id.toString() +
- "-" +
- this.runtime.agentId
+ "-" +
+ this.runtime.agentId
),
agentId,
userId: agentId,
diff --git a/packages/plugin-sui/src/actions/ptb.ts b/packages/plugin-sui/src/actions/ptb.ts
new file mode 100644
index 0000000000..968bd22af0
--- /dev/null
+++ b/packages/plugin-sui/src/actions/ptb.ts
@@ -0,0 +1,354 @@
+import { z } from "zod";
+import {
+ Action,
+ ActionExample,
+ composeContext,
+ Content,
+ elizaLogger,
+ generateObject,
+ HandlerCallback,
+ IAgentRuntime,
+ Memory,
+ ModelClass,
+ State,
+} from "@elizaos/core";
+
+const ArgSchema = z.union([
+ z.object({
+ kind: z.literal("Input"),
+ index: z.number(),
+ }),
+ z.object({
+ kind: z.literal("Result"),
+ index: z.number(),
+ }),
+]);
+
+const InputArgSchema = z.object({
+ kind: z.literal("Input"),
+ index: z.number(),
+});
+
+const TransferObjectsSchema = z.object({
+ TransferObjects: z.object({
+ objects: z.array(ArgSchema),
+ address: ArgSchema,
+ }),
+});
+
+const SplitCoinsSchema = z.object({
+ SplitCoins: z.object({
+ coin: ArgSchema,
+ amounts: z.array(ArgSchema),
+ }),
+});
+
+const MergeCoinsSchema = z.object({
+ MergeCoins: z.object({
+ coin: ArgSchema,
+ toMerge: z.array(ArgSchema),
+ }),
+});
+
+const MakeMoveVecSchema = z.object({
+ MakeMoveVec: z.object({
+ args: z.array(InputArgSchema),
+ }),
+});
+
+const MoveCallSchema = z.object({
+ MoveCall: z.object({
+ target: InputArgSchema,
+ typeArgs: z.array(InputArgSchema),
+ args: z.array(ArgSchema),
+ }),
+});
+
+const PublishSchema = z.object({
+ Publish: z.object({
+ moduleBytes: z.array(InputArgSchema),
+ transitiveDependencies: z.array(InputArgSchema),
+ }),
+});
+
+const UpgradeSchema = z.object({
+ Upgrade: z.object({
+ moduleBytes: z.array(InputArgSchema),
+ transitiveDependencies: z.array(InputArgSchema),
+ package: InputArgSchema,
+ upgradeTicket: InputArgSchema,
+ }),
+});
+
+const CommandSchema = z.union([
+ TransferObjectsSchema,
+ SplitCoinsSchema,
+ MergeCoinsSchema,
+ MakeMoveVecSchema,
+ MoveCallSchema,
+ PublishSchema,
+ UpgradeSchema,
+]);
+
+const ptbSchema = z.object({
+ inputs: z.array(z.union([z.string(), z.number(), z.boolean(), z.null()])),
+ commands: z.array(CommandSchema),
+});
+
+export interface PTBContent extends Content {
+ inputs: (string | number | boolean | null)[];
+ commands: object[];
+}
+
+function isPTBContent(content: Content): content is PTBContent {
+ return (
+ content &&
+ typeof content === "object" &&
+ Array.isArray(content.inputs) &&
+ content.inputs.every((input) =>
+ ["string", "number", "boolean"].includes(typeof input)
+ ) &&
+ Array.isArray(content.commands) &&
+ content.commands.every((command) => typeof command === "object")
+ );
+}
+
+const ptbTemplate = `Respond with a JSON markdown block containing only the extracted commands and inputs. Use null for any commands and inputs that cannot be determined.
+TransferObjects sends multiple (one or more) objects to a specified address.
+SplitCoins splits off multiple (one or more) coins from a single coin.
+MergeCoins merges multiple (one or more) coins into a single coin.
+MakeMoveVec creates a vector (potentially empty) of Move values.
+MoveCall invokes either an entry or a public Move function in a published package.
+Publish creates a new package and calls the init function of each module in the package.
+Upgrade upgrades an existing package.
+
+Example responses:
+\`\`\`json
+{
+ "inputs": ["0x1", 10, 20],
+ "commands": [
+ {
+ "SplitCoins": {
+ "coin": { "kind": "Input", "index": 0 },
+ "amounts": [
+ { "kind": "Input", "index": 1 },
+ { "kind": "Input", "index": 2 }
+ ]
+ }
+ }
+ ]
+}
+\`\`\`
+
+\`\`\`json
+{
+ "inputs": ["0x1", "0x2", "0x3"],
+ "commands": [{
+ "MakeMoveVec": {
+ "args": [
+ { "kind": "Input", "index": 0 },
+ { "kind": "Input", "index": 1 },
+ { "kind": "Input", "index": 2 }
+ ]
+ }
+ }]
+}
+\`\`\`
+
+\`\`\`json
+{
+ "inputs": ["0x1", "0x2", "0x3", "0x4"],
+ "commands": [{
+ "TransferObjects": {
+ "objects": [
+ { "kind": "Input", "index": 0 },
+ { "kind": "Input", "index": 1 },
+ { "kind": "Input", "index": 2 }
+ ],
+ "address": { "kind": "Input", "index": 3 }
+ }
+ }]
+}
+\`\`\`
+
+\`\`\`json
+{
+ "inputs": ["0x1", "0x2", "0x3", "0x4"],
+ "commands": [{
+ "MergeCoins": {
+ "coin": { "kind": "Input", "index": 0 },
+ "toMerge": [
+ { "kind": "Input", "index": 1 },
+ { "kind": "Input", "index": 2 },
+ { "kind": "Input", "index": 3 }
+ ]
+ }
+ }]
+}
+\`\`\`
+
+\`\`\`json
+{
+ "inputs": ["0x1", "0x2", "0x3", "0x4"],
+ "commands": [{
+ "MoveCall": {
+ "target": { "kind": "Input", "index": 0 },
+ "typeArgs": [],
+ "args": [
+ { "kind": "Input", "index": 1 },
+ { "kind": "Input", "index": 2 },
+ { "kind": "Input", "index": 3 }
+ ]
+ }
+ }]
+}
+\`\`\`
+
+\`\`\`json
+{
+ "inputs": ["0x1", "0x2", "0x3", "0x4", "0x5", "0x6"],
+ "commands": [
+ {
+ "Publish": {
+ "moduleBytes": [
+ { "kind": "Input", "index": 0 },
+ { "kind": "Input", "index": 1 },
+ { "kind": "Input", "index": 2 }
+ ],
+ "transitiveDependencies": [
+ { "kind": "Input", "index": 3 },
+ { "kind": "Input", "index": 4 },
+ { "kind": "Input", "index": 5 }
+ ]
+ }
+ }
+ ]
+}
+\`\`\`
+
+{{recentMessages}}
+
+Respond with a JSON markdown block containing only the extracted commands and inputs.`;
+
+export default {
+ name: "BUILD_PTB",
+ similes: [
+ "CONSTRUCT_PTB",
+ "COMPOSE_PTB",
+ "GENERATE_PTB",
+ "PTB",
+ "COMMAND",
+ "TRANSACTION",
+ ],
+ description: "Build a PTB from inputs and commands",
+ validate: async (runtime: IAgentRuntime, message: Memory) => {
+ console.log("Validating PTB build from user:", message.userId);
+ return true;
+ },
+ handler: async (
+ runtime: IAgentRuntime,
+ message: Memory,
+ state: State,
+ _options: { [key: string]: unknown },
+ callback?: HandlerCallback
+ ): Promise => {
+ elizaLogger.log("Starting BUILD_PTB handler...");
+
+ if (!state) {
+ state = (await runtime.composeState(message)) as State;
+ } else {
+ state = await runtime.updateRecentMessageState(state);
+ }
+
+ const ptbContext = composeContext({
+ state,
+ template: ptbTemplate,
+ });
+
+ const content = await generateObject({
+ runtime,
+ context: ptbContext,
+ schema: ptbSchema,
+ modelClass: ModelClass.SMALL,
+ });
+
+ const ptbContent = content.object as PTBContent;
+
+ if (!isPTBContent(ptbContent)) {
+ console.error("Invalid PTB content:", ptbContent);
+ if (callback) {
+ await callback({
+ text: "Unable to process PTB request. Invalid content provided.",
+ content: { error: "Invalid PTB content" },
+ });
+ }
+ }
+
+ if (callback) {
+ await callback({
+ text: JSON.stringify(ptbContent),
+ content: {
+ success: true,
+ },
+ });
+ }
+
+ return true;
+ },
+ examples: [
+ [
+ {
+ user: "{{user1}}",
+ content: {
+ text: "Transfer objects 0x1, 0x2, and 0x3 to address 0x4",
+ },
+ },
+ {
+ user: "{{user2}}",
+ content: {
+ text: "I will generate a PTB that transfers the objects 0x1, 0x2, 0x3 to the address 0x4",
+ action: "BUILD_PTB",
+ },
+ },
+ {
+ user: "{{user1}}",
+ content: {
+ text: "Split coin 0x1 into amounts 10 and 20",
+ },
+ },
+ {
+ user: "{{user2}}",
+ content: {
+ text: "I will generate a PTB that splits the coin 0x1 into amounts 10 and 20",
+ action: "BUILD_PTB",
+ },
+ },
+ {
+ user: "{{user1}}",
+ content: {
+ text: "Merge the coins 0x1, 0x2, and 0x3 into a single coin",
+ },
+ },
+ {
+ user: "{{user2}}",
+ content: {
+ text: "I will generate a PTB that merges the input coins 0x1, 0x2, into 0x3 coin",
+ action: "BUILD_PTB",
+ },
+ },
+ {
+ user: "{{user1}}",
+ content: {
+ text: "Construct a PTB that calls the target 0x883393ee444fb828aa0e977670cf233b0078b41d144e6208719557cb3888244d::hello_wolrd::hello_world with the argument 50",
+ },
+ },
+ {
+ user: "{{user2}}",
+ content: {
+ text: "I will generate a PTB that calls the input target 0x883393ee444fb828aa0e977670cf233b0078b41d144e6208719557cb3888244d::hello_wolrd::hello_world with the input argument 50",
+ action: "BUILD_PTB",
+ },
+ },
+ ],
+ ] as ActionExample[][],
+} as Action;
diff --git a/packages/plugin-sui/src/index.ts b/packages/plugin-sui/src/index.ts
index 5f69381fda..3c0ab5eee2 100644
--- a/packages/plugin-sui/src/index.ts
+++ b/packages/plugin-sui/src/index.ts
@@ -1,5 +1,6 @@
import { Plugin } from "@elizaos/core";
import transferToken from "./actions/transfer.ts";
+import buildPTB from "./actions/ptb.ts";
import { WalletProvider, walletProvider } from "./providers/wallet.ts";
export { WalletProvider, transferToken as TransferSuiToken };
@@ -7,7 +8,7 @@ export { WalletProvider, transferToken as TransferSuiToken };
export const suiPlugin: Plugin = {
name: "sui",
description: "Sui Plugin for Eliza",
- actions: [transferToken],
+ actions: [transferToken, buildPTB],
evaluators: [],
providers: [walletProvider],
};