-
Notifications
You must be signed in to change notification settings - Fork 1
Remove outdated images #11
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| import { Action, Content, HandlerCallback, IAgentRuntime, Memory, State } from '@elizaos/core'; | ||
| import fs from 'fs/promises'; | ||
| import path from 'path'; | ||
| import { logger } from '@elizaos/core'; | ||
|
|
||
| export const getRSSStatusAction: Action = { | ||
| name: 'GET_RSS_STATUS', | ||
| similes: ['RSS_STATUS', 'FEED_STATUS', 'CHECK_RSS'], | ||
| description: 'Get current status of RSS feed and monitoring lists', | ||
|
|
||
| validate: async ( | ||
| _runtime: IAgentRuntime, | ||
| _message: Memory, | ||
| _state: State | ||
| ): Promise<boolean> => { | ||
| return true; | ||
| }, | ||
|
|
||
|
Comment on lines
+6
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Double dip on You’re importing from the same package twice. Collapse them – your bundle (and my patience) will thank you. 🤖 Prompt for AI Agents |
||
| handler: async ( | ||
| runtime: IAgentRuntime, | ||
| message: Memory, | ||
| _state: State, | ||
| _options: any, | ||
| callback: HandlerCallback | ||
| ) => { | ||
| try { | ||
| const outputDir = | ||
| runtime.getSetting?.('RSS_OUTPUT_DIR') || process.env.RSS_OUTPUT_DIR || './rss-feeds'; | ||
| const rssFile = path.join(outputDir, 'twitter_lists.xml'); | ||
|
|
||
| let status = 'RSS Feed Status:\n'; | ||
|
|
||
| try { | ||
| const stats = await fs.stat(rssFile); | ||
| status += `📄 RSS file exists: ${rssFile}\n`; | ||
| status += `📅 Last modified: ${stats.mtime.toLocaleString()}\n`; | ||
| status += `📊 File size: ${(stats.size / 1024).toFixed(1)} KB\n`; | ||
| } catch { | ||
| status += `❌ RSS file not found\n`; | ||
| } | ||
|
|
||
| const lists = ( | ||
| runtime.getSetting?.('TWITTER_LISTS') || process.env.TWITTER_LISTS || '' | ||
| ) | ||
| .split(',') | ||
| .filter(Boolean); | ||
| status += `📋 Monitoring ${lists.length} lists: ${lists.join(', ')}\n`; | ||
| status += `⏱️ Update interval: ${ | ||
| runtime.getSetting?.('RSS_UPDATE_INTERVAL') || process.env.RSS_UPDATE_INTERVAL || '30' | ||
| } minutes\n`; | ||
| status += `🎯 Max tweets per update: ${ | ||
| runtime.getSetting?.('MAX_TWEETS_PER_LIST') || process.env.MAX_TWEETS_PER_LIST || '50' | ||
| }\n`; | ||
|
|
||
| const responseContent: Content = { | ||
| text: status, | ||
| source: message.content.source, | ||
| actions: ['GET_RSS_STATUS'], | ||
| }; | ||
|
|
||
| await callback(responseContent); | ||
| return responseContent; | ||
| } catch (error: any) { | ||
|
Comment on lines
+55
to
+63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Callback before return? Sweet. But what if it explodes?
🤖 Prompt for AI Agents |
||
| logger.error('Status check failed:', error); | ||
|
|
||
| const errorContent: Content = { | ||
| text: `❌ Status check failed: ${error.message}`, | ||
| source: message.content.source, | ||
| }; | ||
|
|
||
| await callback(errorContent); | ||
| return errorContent; | ||
| } | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,57 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Action, Content, HandlerCallback, IAgentRuntime, Memory, State } from '@elizaos/core'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { TwitterRSSService } from '../services/twitterRSSService'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { logger } from '@elizaos/core'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const updateRSSAction: Action = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: 'UPDATE_RSS_FEED', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| similes: ['REFRESH_RSS', 'UPDATE_FEED', 'FETCH_LISTS'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: 'Update RSS feed with latest tweets from monitored Twitter lists', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validate: async ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runtime: IAgentRuntime, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _message: Memory, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _state: State | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ): Promise<boolean> => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const service = runtime.getService(TwitterRSSService.serviceType); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return service instanceof TwitterRSSService; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Your validation is playing it safe, but maybe too safe. You're checking if the service exists and is the right type, but what if the service is there but not initialized? That's like checking if someone's home but not if they're awake, honey! Consider a more thorough validation: validate: async (
runtime: IAgentRuntime,
_message: Memory,
_state: State
): Promise<boolean> => {
const service = runtime.getService(TwitterRSSService.serviceType);
- return service instanceof TwitterRSSService;
+ if (!(service instanceof TwitterRSSService)) {
+ return false;
+ }
+ // Could add additional checks here like service initialization state
+ return true;
},📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| handler: async ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runtime: IAgentRuntime, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: Memory, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _state: State, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _options: any, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| callback: HandlerCallback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const service = runtime.getService( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TwitterRSSService.serviceType | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) as TwitterRSSService; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!service) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| throw new Error('Twitter RSS service not available'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const result = await service.processAllLists(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const responseContent: Content = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| text: `RSS feed updated successfully!\n📊 Processed ${result.totalTweets} new tweets\n📁 RSS file: ${result.rssPath}\n🕒 Last updated: ${new Date().toLocaleString()}`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| source: message.content.source, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| actions: ['UPDATE_RSS_FEED'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await callback(responseContent); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return responseContent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (error: any) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.error('RSS update failed:', error); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const errorContent: Content = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| text: `❌ RSS update failed: ${error.message}`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| source: message.content.source, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await callback(errorContent); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return errorContent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+45
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Error handling with style, but missing some tea. You're catching and logging errors like a pro, but you're not giving users much to work with. When things go sideways, people want to know why, not just that it happened. Consider providing more context in error messages: } catch (error: any) {
- logger.error('RSS update failed:', error);
+ logger.error('RSS update failed:', {
+ error: error.message,
+ stack: error.stack,
+ timestamp: new Date().toISOString()
+ });
const errorContent: Content = {
- text: `❌ RSS update failed: ${error.message}`,
+ text: `❌ RSS update failed: ${error.message}\n💡 Check logs for more details or try again in a few minutes`,
source: message.content.source,
};📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Yo, throw the
node:protocol on those built-ins, queen.Biome is already side-eyeing you. Do the explicit import dance so future linters stop nagging.
📝 Committable suggestion
🧰 Tools
🪛 Biome (1.9.4)
[error] 2-2: A Node.js builtin module should be imported with the node: protocol.
Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.
Unsafe fix: Add the node: protocol.
(lint/style/useNodejsImportProtocol)
[error] 3-3: A Node.js builtin module should be imported with the node: protocol.
Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.
Unsafe fix: Add the node: protocol.
(lint/style/useNodejsImportProtocol)
🤖 Prompt for AI Agents