neoagent 2.5.1 → 2.5.2-beta.1
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.
- package/README.md +6 -24
- package/flutter_app/lib/main_operations.dart +7 -0
- package/package.json +1 -1
- package/server/public/.last_build_id +1 -1
- package/server/public/assets/fonts/MaterialIcons-Regular.otf +0 -0
- package/server/public/flutter_bootstrap.js +1 -1
- package/server/public/main.dart.js +3159 -3157
- package/server/routes/triggers.js +36 -18
- package/server/services/ai/engine.js +545 -46
- package/server/services/ai/tools.js +26 -16
- package/server/services/tasks/adapters/android_notification_received.js +18 -0
- package/server/services/tasks/adapters/index.js +2 -0
|
@@ -67,24 +67,42 @@ router.post('/notification', async (req, res) => {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
// Fire-and-forget after response is sent — errors here must never touch res.
|
|
70
|
-
Promise.resolve().then(() => {
|
|
71
|
-
const
|
|
72
|
-
if (!
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
70
|
+
Promise.resolve().then(async () => {
|
|
71
|
+
const taskRuntime = req.app.locals.taskRuntime;
|
|
72
|
+
if (!taskRuntime) return;
|
|
73
|
+
|
|
74
|
+
const tasks = taskRuntime.taskRepository.listEnabledByTriggerTypes(['android_notification_received']) || [];
|
|
75
|
+
for (const task of tasks) {
|
|
76
|
+
if (task.user_id !== req.session.userId) continue;
|
|
77
|
+
|
|
78
|
+
let config = {};
|
|
79
|
+
try {
|
|
80
|
+
config = JSON.parse(task.trigger_config || '{}');
|
|
81
|
+
} catch (e) {}
|
|
82
|
+
|
|
83
|
+
if (config.appPackage && config.appPackage.trim() && config.appPackage.trim() !== app_package) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const payload = {
|
|
88
|
+
fingerprint: `notification:${Date.now()}:${Math.random().toString(36).substr(2, 5)}`,
|
|
89
|
+
timestamp: new Date().toISOString(),
|
|
90
|
+
context: {
|
|
91
|
+
triggerEvent: {
|
|
92
|
+
provider: 'android_notification',
|
|
93
|
+
appPackage: app_package,
|
|
94
|
+
title: title,
|
|
95
|
+
body: body,
|
|
96
|
+
actionTaken: action_taken
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
await taskRuntime.fireTaskFromTrigger(task.id, task.user_id, payload).catch(err => {
|
|
102
|
+
console.error('[Triggers] Notification task trigger failed:', err.message);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}).catch(err => console.error('[Triggers] Notification background processing failed:', err.message));
|
|
88
106
|
});
|
|
89
107
|
|
|
90
108
|
module.exports = router;
|