nyxora 26.7.3 → 26.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/README.md +2 -2
  3. package/dist/packages/core/src/agent/llmProvider.js +4 -1
  4. package/dist/packages/core/src/agent/nyxDaemon.js +1 -1
  5. package/dist/packages/core/src/agent/osAgent.js +149 -1
  6. package/dist/packages/core/src/agent/reasoning.js +1 -1
  7. package/dist/packages/core/src/agent/web3Agent.js +1 -1
  8. package/dist/packages/core/src/gateway/googleAuthModule.js +2 -0
  9. package/dist/packages/core/src/gateway/telegram.js +7 -7
  10. package/dist/packages/core/src/memory/episodic.js +16 -5
  11. package/dist/packages/core/src/system/plugins/GoogleWorkspacePlugin.js +9 -1
  12. package/dist/packages/core/src/system/skills/executeShell.js +31 -4
  13. package/dist/packages/core/src/system/skills/googleWorkspace.js +106 -1
  14. package/dist/packages/core/src/system/skills/searchWeb.js +13 -6
  15. package/dist/packages/core/src/web3/skills/getPrice.js +1 -1
  16. package/dist/packages/core/src/web3/skills/marketAnalysis.js +1 -1
  17. package/package.json +3 -2
  18. package/packages/core/package.json +1 -1
  19. package/packages/core/src/agent/llmProvider.ts +4 -2
  20. package/packages/core/src/agent/nyxDaemon.ts +1 -1
  21. package/packages/core/src/agent/osAgent.ts +152 -1
  22. package/packages/core/src/agent/reasoning.ts +1 -1
  23. package/packages/core/src/agent/web3Agent.ts +1 -1
  24. package/packages/core/src/gateway/googleAuthModule.ts +2 -0
  25. package/packages/core/src/gateway/telegram.ts +7 -7
  26. package/packages/core/src/memory/episodic.ts +21 -9
  27. package/packages/core/src/system/plugins/GoogleWorkspacePlugin.ts +14 -2
  28. package/packages/core/src/system/skills/executeShell.ts +38 -7
  29. package/packages/core/src/system/skills/googleWorkspace.ts +109 -0
  30. package/packages/core/src/system/skills/searchWeb.ts +12 -6
  31. package/packages/core/src/web3/skills/getPrice.ts +1 -1
  32. package/packages/core/src/web3/skills/marketAnalysis.ts +1 -1
  33. package/packages/dashboard/dist/assets/{index-BTfp141V.js → index-Czxksiao.js} +1 -1
  34. package/packages/dashboard/dist/index.html +1 -1
  35. package/packages/dashboard/package.json +1 -1
  36. package/packages/mcp-server/package.json +1 -1
  37. package/packages/ml-engine/__pycache__/config.cpython-313.pyc +0 -0
  38. package/packages/ml-engine/__pycache__/main.cpython-313.pyc +0 -0
  39. package/packages/ml-engine/config.py +59 -0
  40. package/packages/ml-engine/main.py +34 -0
  41. package/packages/ml-engine/requirements.txt +22 -0
  42. package/packages/ml-engine/routers/__init__.py +1 -0
  43. package/packages/ml-engine/routers/__pycache__/__init__.cpython-313.pyc +0 -0
  44. package/packages/ml-engine/routers/__pycache__/cognitive.cpython-313.pyc +0 -0
  45. package/packages/ml-engine/routers/__pycache__/critic.cpython-313.pyc +0 -0
  46. package/packages/ml-engine/routers/__pycache__/llm.cpython-313.pyc +0 -0
  47. package/packages/ml-engine/routers/__pycache__/market.cpython-313.pyc +0 -0
  48. package/packages/ml-engine/routers/__pycache__/memory.cpython-313.pyc +0 -0
  49. package/packages/ml-engine/routers/cognitive.py +98 -0
  50. package/packages/ml-engine/routers/critic.py +111 -0
  51. package/packages/ml-engine/routers/llm.py +38 -0
  52. package/packages/ml-engine/routers/market.py +332 -0
  53. package/packages/ml-engine/routers/memory.py +125 -0
  54. package/packages/policy/package.json +1 -1
  55. package/packages/signer/package.json +1 -1
@@ -248,3 +248,112 @@ export const readGoogleFormResponsesToolDefinition = {
248
248
  },
249
249
  },
250
250
  };
251
+
252
+ export async function sendEmail(to: string, subject: string, body: string): Promise<string> {
253
+ const isAuth = await isAuthenticated();
254
+ if (!isAuth) return "Google Auth not configured. Please link your Google account in the dashboard.";
255
+ const token = await getAccessToken();
256
+ if (!token) return "Failed to retrieve access token.";
257
+
258
+ try {
259
+ const messageParts = [
260
+ `To: ${to}`,
261
+ `Subject: ${subject}`,
262
+ `Content-Type: text/plain; charset=utf-8`,
263
+ '',
264
+ body
265
+ ];
266
+ const message = messageParts.join('\n');
267
+ const encodedMessage = Buffer.from(message).toString('base64')
268
+ .replace(/\+/g, '-')
269
+ .replace(/\//g, '_')
270
+ .replace(/=+$/, '');
271
+
272
+ const res = await fetch(`https://gmail.googleapis.com/gmail/v1/users/me/messages/send`, {
273
+ method: 'POST',
274
+ headers: {
275
+ Authorization: `Bearer ${token}`,
276
+ 'Content-Type': 'application/json'
277
+ },
278
+ body: JSON.stringify({ raw: encodedMessage })
279
+ });
280
+
281
+ const data = await res.json();
282
+ if (!res.ok) {
283
+ return `Failed to send email: ${data.error?.message || JSON.stringify(data)}`;
284
+ }
285
+
286
+ return `Successfully sent email to ${to} with Message ID: ${data.id}`;
287
+ } catch (err: any) {
288
+ return `Error sending email: ${err.message}`;
289
+ }
290
+ }
291
+
292
+ export async function addCalendarEvent(summary: string, description: string, startTime: string, endTime: string): Promise<string> {
293
+ const isAuth = await isAuthenticated();
294
+ if (!isAuth) return "Google Auth not configured. Please link your Google account in the dashboard.";
295
+ const token = await getAccessToken();
296
+ if (!token) return "Failed to retrieve access token.";
297
+
298
+ try {
299
+ const event = {
300
+ summary,
301
+ description,
302
+ start: { dateTime: startTime },
303
+ end: { dateTime: endTime }
304
+ };
305
+
306
+ const res = await fetch(`https://www.googleapis.com/calendar/v3/calendars/primary/events`, {
307
+ method: 'POST',
308
+ headers: {
309
+ Authorization: `Bearer ${token}`,
310
+ 'Content-Type': 'application/json'
311
+ },
312
+ body: JSON.stringify(event)
313
+ });
314
+
315
+ const data = await res.json();
316
+ if (!res.ok) {
317
+ return `Failed to add calendar event: ${data.error?.message || JSON.stringify(data)}`;
318
+ }
319
+
320
+ return `Successfully added event '${summary}'. Event link: ${data.htmlLink}`;
321
+ } catch (err: any) {
322
+ return `Error adding calendar event: ${err.message}`;
323
+ }
324
+ }
325
+
326
+ export const sendEmailToolDefinition = {
327
+ type: "function",
328
+ function: {
329
+ name: "send_email",
330
+ description: "Sends an email using the user's Gmail account.",
331
+ parameters: {
332
+ type: "object",
333
+ properties: {
334
+ to: { type: "string", description: "The recipient's email address." },
335
+ subject: { type: "string", description: "The subject of the email." },
336
+ body: { type: "string", description: "The plain text body of the email." }
337
+ },
338
+ required: ["to", "subject", "body"],
339
+ },
340
+ },
341
+ };
342
+
343
+ export const addCalendarEventToolDefinition = {
344
+ type: "function",
345
+ function: {
346
+ name: "add_calendar_event",
347
+ description: "Adds a new event to the user's primary Google Calendar.",
348
+ parameters: {
349
+ type: "object",
350
+ properties: {
351
+ summary: { type: "string", description: "The title or summary of the event." },
352
+ description: { type: "string", description: "A description of the event." },
353
+ startTime: { type: "string", description: "Start time of the event in ISO 8601 format (e.g. 2026-07-03T09:00:00+07:00)." },
354
+ endTime: { type: "string", description: "End time of the event in ISO 8601 format (e.g. 2026-07-03T10:00:00+07:00)." }
355
+ },
356
+ required: ["summary", "description", "startTime", "endTime"],
357
+ },
358
+ },
359
+ };
@@ -155,7 +155,7 @@ export async function searchWeb(query: string, depth: number = 1): Promise<strin
155
155
  const config = loadConfig();
156
156
  const provider = config.web_search?.provider || 'mesh';
157
157
  const vaultKeys = await loadApiKeys();
158
- const creds = Object.keys(vaultKeys).length > 0 ? vaultKeys : (config.credentials || {});
158
+ const creds = { ...(config.credentials || {}), ...vaultKeys };
159
159
 
160
160
  let results: SearchQueryResult[] = [];
161
161
 
@@ -230,10 +230,16 @@ export async function searchWeb(query: string, depth: number = 1): Promise<strin
230
230
  results = await searchSearxng(finalQuery, depth);
231
231
  }
232
232
  } else {
233
- results = await searchSearxng(finalQuery, depth);
233
+ // Default 'mesh' provider - Prioritize DuckDuckGo as it's more reliable than public SearXNG instances
234
+ try {
235
+ results = await searchDuckDuckGo(finalQuery, depth);
236
+ } catch (e: any) {
237
+ console.warn('[WebSearch] Mesh: DuckDuckGo failed. Falling back to SearXNG...');
238
+ results = await searchSearxng(finalQuery, depth);
239
+ }
234
240
  }
235
241
  } catch (e: any) {
236
- return `Failed to search the web: ${e.message}`;
242
+ return `[Search Failed] The web search failed due to an error: ${e.message}. CRITICAL INSTRUCTION: You MUST inform the user that the web search failed. Do NOT hallucinate or guess the answer.`;
237
243
  }
238
244
 
239
245
  if (results.length > 0) {
@@ -265,17 +271,17 @@ export const searchWebToolDefinition = {
265
271
  type: "function",
266
272
  function: {
267
273
  name: "search_web",
268
- description: "Searches the internet for information using a search engine. Returns top titles, snippets, and URLs. Use this to find current events, documentation, or general facts. If the user asks for deep/comprehensive research, pass depth: 2 or 3.",
274
+ description: "Searches the internet for information using a search engine. Returns top titles, snippets, and URLs. CRITICAL: If the user asks for news, sports scores, current events, or factual dates, you MUST set depth: 2 to extract the full article content. Do not use depth 1 for facts.",
269
275
  parameters: {
270
276
  type: "object",
271
277
  properties: {
272
278
  query: {
273
279
  type: "string",
274
- description: "The search query to look up.",
280
+ description: "The highly optimized search query to look up (translate to English for global events).",
275
281
  },
276
282
  depth: {
277
283
  type: "number",
278
- description: "Depth of the search (1 for basic, 2 or 3 for deep comprehensive research). Default is 1.",
284
+ description: "Depth of the search (1 for basic snippets, 2 for deep scraping of top 3 sites). MUST be 2 for news/scores/facts.",
279
285
  }
280
286
  },
281
287
  required: ["query"],
@@ -103,7 +103,7 @@ export async function getPrice(coinId: string, currency?: string, amount?: numbe
103
103
  // TIER 3: Nyxora Python ML Engine (For obscure/low-cap DEX tokens)
104
104
  if (tokenUsdPrice === 0) {
105
105
  try {
106
- const mlData = await safeFetchJson<any>(`http://localhost:8000/web3/analyze?query=${coinId}&chain=ethereum`);
106
+ const mlData = await safeFetchJson<any>(`http://127.0.0.1:8000/web3/analyze?query=${coinId}&chain=ethereum`);
107
107
  if (mlData && mlData.currentPrice) {
108
108
  tokenUsdPrice = mlData.currentPrice;
109
109
  change24h = mlData.priceChange24h || 0;
@@ -15,7 +15,7 @@ export async function analyzeMarket(chainName: ChainName, tokenAddressOrSymbol:
15
15
 
16
16
  let mlData;
17
17
  try {
18
- mlData = await safeFetchJson<any>(`http://localhost:8000/web3/analyze?query=${tokenAddressOrSymbol}&chain=${chainName}`);
18
+ mlData = await safeFetchJson<any>(`http://127.0.0.1:8000/web3/analyze?query=${tokenAddressOrSymbol}&chain=${chainName}`);
19
19
  } catch (error: any) {
20
20
  return `[System Error] Failed to reach Python ML Engine. Make sure the daemon is running (Error: ${error.message})`;
21
21
  }