@@ -162,86 +162,45 @@ export const LpManagementAgentAction: Action = {
162162
163163 examples : [ ] as ActionExample [ ] [ ] , // Empty for now - add examples when specific LP workflows are documented
164164
165- validate : async ( runtime : IAgentRuntime , message : Memory , state ?: State ) : Promise < boolean > => {
166- const __avTextRaw = typeof message ?. content ?. text === "string" ? message . content . text : "" ;
167- const __avText = __avTextRaw . toLowerCase ( ) ;
168- const __avKeywords = [ "management" ] ;
169- const __avKeywordOk =
170- __avKeywords . length > 0 && __avKeywords . some ( ( kw ) => kw . length > 0 && __avText . includes ( kw ) ) ;
171- const __avRegex = / \b (?: m a n a g e m e n t ) \b / i;
172- const __avRegexOk = __avRegex . test ( __avText ) ;
173- const __avSource = String ( message ?. content ?. source ?? "" ) ;
174- const __avExpectedSource = "" ;
175- const __avSourceOk = __avExpectedSource
176- ? __avSource === __avExpectedSource
177- : Boolean ( __avSource || state || runtime ?. agentId || runtime ?. getService ) ;
178- const __avInputOk =
179- __avText . trim ( ) . length > 0 ||
180- Boolean ( message ?. content && typeof message . content === "object" ) ;
181-
182- if ( ! ( __avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk ) ) {
165+ validate : async ( _runtime : IAgentRuntime , message : Memory , _state ?: State ) : Promise < boolean > => {
166+ if ( ! message ?. content ?. text ) {
183167 return false ;
184168 }
185169
186- const __avLegacyValidate = async (
187- _runtime : IAgentRuntime ,
188- message : Memory ,
189- _state ?: State
190- ) : Promise < boolean > => {
191- console . info (
192- "[LpManagementAgentAction] Validate called with message:" ,
193- message ?. content ?. text || "No text"
194- ) ;
195-
196- // If there's no message content, validation fails
197- if ( ! message ?. content ?. text ) {
198- console . info ( "[LpManagementAgentAction] No message text, returning false" ) ;
199- return false ;
200- }
201-
202- const text = message . content . text . toLowerCase ( ) ;
203-
204- // Check for LP-related keywords in the message
205- const lpKeywords = [
206- "liquidity" ,
207- "lp" ,
208- "pool" ,
209- "dex" ,
210- "vault" ,
211- "slippage" ,
212- "apr" ,
213- "apy" ,
214- "tvl" ,
215- "swap" ,
216- "balance" ,
217- "position" ,
218- "yield" ,
219- "deposit" ,
220- "withdraw" ,
221- "rebalance" ,
222- "auto-rebalance" ,
223- "auto rebalance" ,
224- "enable rebalance" ,
225- "preference" ,
226- "slippage" ,
227- "concentrated" ,
228- "range" ,
229- "price range" ,
230- "narrow" ,
231- "tight" ,
232- "out of range" ,
233- ] ;
234-
235- const hasLpKeyword = lpKeywords . some ( ( keyword ) => text . includes ( keyword ) ) ;
236- console . info ( "[LpManagementAgentAction] Has LP keyword:" , hasLpKeyword ) ;
237-
238- return hasLpKeyword ;
239- } ;
240- try {
241- return Boolean ( await __avLegacyValidate ( runtime , message , state ) ) ;
242- } catch {
243- return false ;
244- }
170+ const text = message . content . text . toLowerCase ( ) ;
171+
172+ const lpKeywords = [
173+ "liquidity" ,
174+ "lp" ,
175+ "pool" ,
176+ "dex" ,
177+ "vault" ,
178+ "slippage" ,
179+ "apr" ,
180+ "apy" ,
181+ "tvl" ,
182+ "swap" ,
183+ "balance" ,
184+ "position" ,
185+ "yield" ,
186+ "deposit" ,
187+ "withdraw" ,
188+ "rebalance" ,
189+ "auto-rebalance" ,
190+ "auto rebalance" ,
191+ "enable rebalance" ,
192+ "preference" ,
193+ "concentrated" ,
194+ "range" ,
195+ "price range" ,
196+ "narrow" ,
197+ "tight" ,
198+ "out of range" ,
199+ "management" ,
200+ "intent" ,
201+ ] ;
202+
203+ return lpKeywords . some ( ( keyword ) => text . includes ( keyword ) ) ;
245204 } ,
246205
247206 handler : async ( runtime , message , _state ) => {
0 commit comments