nyxora 1.1.3 → 1.1.5

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.
@@ -111,8 +111,13 @@ async function processUserInput(input, role = 'user') {
111
111
  // Format messages for OpenAI
112
112
  const messages = [
113
113
  { role: 'system', content: getSystemPrompt() },
114
- ...history.map(m => {
115
- const msg = { role: m.role, content: m.content || "" };
114
+ ...history
115
+ .filter(m => !(m.role === 'tool' && !m.tool_call_id))
116
+ .map(m => {
117
+ let role = m.role;
118
+ if (role === 'system')
119
+ role = 'user';
120
+ const msg = { role, content: m.content || "" };
116
121
  if (m.name)
117
122
  msg.name = m.name;
118
123
  if (m.tool_call_id)
@@ -195,8 +200,13 @@ async function processUserInput(input, role = 'user') {
195
200
  // Second call to get the final answer after tool execution
196
201
  const secondMessages = [
197
202
  { role: 'system', content: getSystemPrompt() },
198
- ...exports.logger.getHistory().map(m => {
199
- const msg = { role: m.role, content: m.content || "" };
203
+ ...exports.logger.getHistory()
204
+ .filter(m => !(m.role === 'tool' && !m.tool_call_id))
205
+ .map(m => {
206
+ let role = m.role;
207
+ if (role === 'system')
208
+ role = 'user';
209
+ const msg = { role, content: m.content || "" };
200
210
  if (m.name)
201
211
  msg.name = m.name;
202
212
  if (m.tool_call_id)
@@ -119,6 +119,8 @@ app.post('/api/transactions/:id/approve', async (req, res) => {
119
119
  // Add programmatic beautiful message directly to chat
120
120
  const prettyMsg = (0, formatter_1.formatTransactionSuccess)(tx, result);
121
121
  reasoning_1.logger.addEntry({ role: 'assistant', content: `✅ Transaction processed:\n\n${prettyMsg}` });
122
+ // Add tool message so the UI can render the beautiful JSON widget!
123
+ reasoning_1.logger.addEntry({ role: 'tool', name: tx.type === 'swap' ? 'swap_token' : 'transfer_native', content: result });
122
124
  // Background update to LLM
123
125
  (0, reasoning_1.processUserInput)(`Transaction ${id} was APPROVED and EXECUTED by the user via Dashboard. Result: ${result}`, 'system').catch(() => { });
124
126
  res.json({ success: true, result });
@@ -81,6 +81,9 @@ function startTelegramBot() {
81
81
  transactionManager_1.txManager.updateStatus(txId, 'executed', result);
82
82
  const prettyMsg = (0, formatter_1.formatTransactionSuccess)(tx, result);
83
83
  bot.sendMessage(chatId, `✅ Transaction processed:\n\n${prettyMsg}`);
84
+ // Sync with dashboard
85
+ reasoning_1.logger.addEntry({ role: 'assistant', content: `✅ Transaction processed:\n\n${prettyMsg}` });
86
+ reasoning_1.logger.addEntry({ role: 'tool', name: tx.type === 'swap' ? 'swap_token' : 'transfer_native', content: result });
84
87
  // Background update to LLM
85
88
  (0, reasoning_1.processUserInput)(`Transaction ${txId} was APPROVED via Telegram. Result: ${result}`, 'system').catch(() => { });
86
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nyxora",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "",
5
5
  "main": "dist/gateway/cli.js",
6
6
  "files": [