File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import { XMCPServer } from './mcp/server.js';
1010async function main ( ) {
1111 // Redirect console.log to stderr so it doesn't conflict with
1212 // MCP StdioServerTransport which uses stdout for protocol messages
13- console . log = ( ...args : any [ ] ) => console . error ( ...args ) ;
13+ console . log = ( ...args : unknown [ ] ) => console . error ( ...args ) ;
1414
1515 console . log ( '═══════════════════════════════════════════════════' ) ;
1616 console . log ( ' MyXstack - Autonomous AI Agent on X (Twitter)' ) ;
Original file line number Diff line number Diff line change @@ -102,7 +102,11 @@ export class AutonomousAgent {
102102 const excess = this . processedMentions . size - AutonomousAgent . MAX_PROCESSED_MENTIONS ;
103103 const iter = this . processedMentions . values ( ) ;
104104 for ( let i = 0 ; i < excess ; i ++ ) {
105- this . processedMentions . delete ( iter . next ( ) . value as string ) ;
105+ const { value, done } = iter . next ( ) ;
106+ if ( done ) {
107+ break ;
108+ }
109+ this . processedMentions . delete ( value ) ;
106110 }
107111 }
108112 } catch ( error ) {
Original file line number Diff line number Diff line change @@ -91,6 +91,11 @@ export class XAPIClient {
9191 return null ;
9292 }
9393
94+ if ( ! Array . isArray ( response . data ) ) {
95+ console . warn ( 'X API thread response data is not an array' ) ;
96+ return null ;
97+ }
98+
9499 return this . parseThread ( response . data ) ;
95100 } catch ( error ) {
96101 console . error ( 'Error fetching thread:' , error ) ;
You can’t perform that action at this time.
0 commit comments