vantuz 3.4.1 → 3.5.0

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 (70) hide show
  1. package/LICENSE +45 -45
  2. package/admin-keygen.js +51 -0
  3. package/cli.js +685 -585
  4. package/config.js +733 -733
  5. package/core/agent-loop.js +190 -190
  6. package/core/ai-provider.js +298 -261
  7. package/core/automation.js +523 -523
  8. package/core/brand-analyst.js +101 -0
  9. package/core/channels.js +167 -167
  10. package/core/dashboard.js +230 -230
  11. package/core/database.js +135 -36
  12. package/core/eia-monitor.js +3 -1
  13. package/core/engine.js +648 -636
  14. package/core/gateway.js +447 -447
  15. package/core/learning.js +214 -214
  16. package/core/license.js +113 -0
  17. package/core/marketplace-adapter.js +168 -168
  18. package/core/memory.js +190 -190
  19. package/core/migrations/001-initial-schema.sql +1 -1
  20. package/core/queue.js +120 -120
  21. package/core/self-healer.js +314 -314
  22. package/core/unified-product.js +214 -214
  23. package/core/vision-service.js +113 -113
  24. package/index.js +217 -174
  25. package/modules/crm/sentiment-crm.js +231 -231
  26. package/modules/healer/listing-healer.js +201 -201
  27. package/modules/oracle/predictor.js +214 -214
  28. package/modules/researcher/agent.js +169 -169
  29. package/modules/team/agents/base.js +92 -92
  30. package/modules/team/agents/dev.js +33 -33
  31. package/modules/team/agents/josh.js +40 -40
  32. package/modules/team/agents/marketing.js +33 -33
  33. package/modules/team/agents/milo.js +36 -36
  34. package/modules/team/index.js +78 -78
  35. package/modules/team/shared-memory.js +87 -87
  36. package/modules/war-room/competitor-tracker.js +250 -250
  37. package/modules/war-room/pricing-engine.js +308 -308
  38. package/nodes/warehouse.js +238 -238
  39. package/onboard.js +1 -1
  40. package/package.json +7 -6
  41. package/platforms/pttavm.js +14 -14
  42. package/plugins/vantuz/index.js +528 -528
  43. package/plugins/vantuz/memory/hippocampus.js +465 -464
  44. package/plugins/vantuz/package.json +20 -20
  45. package/plugins/vantuz/platforms/_template.js +118 -118
  46. package/plugins/vantuz/platforms/amazon.js +236 -236
  47. package/plugins/vantuz/platforms/ciceksepeti.js +166 -166
  48. package/plugins/vantuz/platforms/hepsiburada.js +180 -180
  49. package/plugins/vantuz/platforms/index.js +165 -165
  50. package/plugins/vantuz/platforms/n11.js +229 -229
  51. package/plugins/vantuz/platforms/pazarama.js +154 -154
  52. package/plugins/vantuz/platforms/pttavm.js +127 -127
  53. package/plugins/vantuz/platforms/trendyol.js +326 -326
  54. package/plugins/vantuz/services/alerts.js +253 -253
  55. package/plugins/vantuz/services/license.js +34 -34
  56. package/plugins/vantuz/services/scheduler.js +232 -232
  57. package/plugins/vantuz/tools/analytics.js +152 -152
  58. package/plugins/vantuz/tools/crossborder.js +187 -187
  59. package/plugins/vantuz/tools/nl-parser.js +211 -211
  60. package/plugins/vantuz/tools/product.js +110 -110
  61. package/plugins/vantuz/tools/quick-report.js +175 -175
  62. package/plugins/vantuz/tools/repricer.js +314 -314
  63. package/plugins/vantuz/tools/sentiment.js +115 -115
  64. package/plugins/vantuz/tools/vision.js +257 -257
  65. package/private.pem +28 -0
  66. package/public.pem +9 -0
  67. package/server/app.js +260 -260
  68. package/server/public/index.html +514 -514
  69. package/start.bat +33 -33
  70. package/vantuz.sqlite +0 -0
@@ -1,232 +1,232 @@
1
- /**
2
- * ⏰ CRON ZAMANLAYICI
3
- * Vantuz cron entegrasyonu ile otomatik görevler
4
- */
5
-
6
- const PRESETS = {
7
- '15dk': '*/15 * * * *', // Her 15 dakikada
8
- '30dk': '*/30 * * * *', // Her 30 dakikada
9
- 'saatlik': '0 * * * *', // Her saat başı
10
- 'gunluk-9': '0 9 * * *', // Her gün 09:00
11
- 'gunluk-18': '0 18 * * *', // Her gün 18:00
12
- 'haftalik': '0 9 * * 1', // Pazartesi 09:00
13
- 'aylik': '0 9 1 * *' // Ayın 1'i 09:00
14
- };
15
-
16
- const TASK_TEMPLATES = {
17
- 'rakip-kontrol': {
18
- prompt: 'Tüm ürünlerin rakip fiyatlarını kontrol et ve avantaj/dezavantaj durumunu raporla',
19
- defaultSchedule: '*/15 * * * *'
20
- },
21
- 'stok-uyari': {
22
- prompt: 'Stoku 5 ve altına düşen ürünleri tespit et ve kritik olanları bildir',
23
- defaultSchedule: '0 */2 * * *'
24
- },
25
- 'gunluk-rapor': {
26
- prompt: 'Günlük satış özeti hazırla: toplam ciro, sipariş sayısı, en çok satanlar',
27
- defaultSchedule: '0 18 * * *'
28
- },
29
- 'haftalik-analiz': {
30
- prompt: 'Haftalık performans analizi: satış trendi, kar marjı, en iyi/kötü ürünler',
31
- defaultSchedule: '0 9 * * 1'
32
- },
33
- 'fiyat-optimizasyon': {
34
- prompt: 'Düşük satış hızlı ürünlerde fiyat optimizasyonu öner',
35
- defaultSchedule: '0 10 * * *'
36
- },
37
- 'yorum-analiz': {
38
- prompt: 'Son 24 saatteki olumsuz yorumları analiz et ve aksiyon öner',
39
- defaultSchedule: '0 9 * * *'
40
- }
41
- };
42
-
43
- export class SchedulerService {
44
- constructor(api) {
45
- this.api = api;
46
- this.jobs = new Map();
47
- }
48
-
49
- /**
50
- * Hazır şablon ekle
51
- */
52
- async addPreset(taskName, customSchedule = null) {
53
- const template = TASK_TEMPLATES[taskName];
54
- if (!template) {
55
- return { success: false, error: `Bilinmeyen görev: ${taskName}` };
56
- }
57
-
58
- const schedule = customSchedule || template.defaultSchedule;
59
- return await this.addJob({
60
- id: `vantuz-${taskName}`,
61
- schedule,
62
- prompt: template.prompt
63
- });
64
- }
65
-
66
- /**
67
- * Özel görev ekle
68
- */
69
- async addJob(job) {
70
- const { id, schedule, prompt, enabled = true } = job;
71
-
72
- // Cron ifadesini çöz
73
- const cronSchedule = PRESETS[schedule] || schedule;
74
-
75
- try {
76
- if (this.api.cron) {
77
- await this.api.cron.add({
78
- id,
79
- schedule: cronSchedule,
80
- action: {
81
- type: 'agent',
82
- prompt: prompt
83
- },
84
- enabled
85
- });
86
- }
87
-
88
- this.jobs.set(id, { ...job, cronSchedule });
89
- return { success: true, jobId: id };
90
- } catch (error) {
91
- return { success: false, error: error.message };
92
- }
93
- }
94
-
95
- /**
96
- * Görev sil
97
- */
98
- async removeJob(jobId) {
99
- try {
100
- if (this.api.cron) {
101
- await this.api.cron.remove({ jobId });
102
- }
103
- this.jobs.delete(jobId);
104
- return { success: true };
105
- } catch (error) {
106
- return { success: false, error: error.message };
107
- }
108
- }
109
-
110
- /**
111
- * Görevi hemen çalıştır
112
- */
113
- async runNow(jobId) {
114
- try {
115
- if (this.api.cron) {
116
- await this.api.cron.run({ jobId });
117
- }
118
- return { success: true };
119
- } catch (error) {
120
- return { success: false, error: error.message };
121
- }
122
- }
123
-
124
- /**
125
- * Görevi duraklat/devam ettir
126
- */
127
- async toggleJob(jobId, enabled) {
128
- try {
129
- if (this.api.cron) {
130
- await this.api.cron.update({ jobId, patch: { enabled } });
131
- }
132
- const job = this.jobs.get(jobId);
133
- if (job) {
134
- job.enabled = enabled;
135
- }
136
- return { success: true };
137
- } catch (error) {
138
- return { success: false, error: error.message };
139
- }
140
- }
141
-
142
- /**
143
- * Tüm görevleri listele
144
- */
145
- async listJobs() {
146
- try {
147
- if (this.api.cron) {
148
- const result = await this.api.cron.list();
149
- return { success: true, jobs: result };
150
- }
151
- return { success: true, jobs: Array.from(this.jobs.values()) };
152
- } catch (error) {
153
- return { success: false, error: error.message };
154
- }
155
- }
156
-
157
- /**
158
- * Mevcut şablonları listele
159
- */
160
- getTemplates() {
161
- return Object.entries(TASK_TEMPLATES).map(([key, val]) => ({
162
- name: key,
163
- description: val.prompt,
164
- schedule: val.defaultSchedule,
165
- scheduleHuman: this.cronToHuman(val.defaultSchedule)
166
- }));
167
- }
168
-
169
- /**
170
- * Cron ifadesini insan diline çevir
171
- */
172
- cronToHuman(cron) {
173
- const mappings = {
174
- '*/15 * * * *': 'Her 15 dakikada bir',
175
- '*/30 * * * *': 'Her 30 dakikada bir',
176
- '0 * * * *': 'Her saat başı',
177
- '0 9 * * *': 'Her gün 09:00',
178
- '0 10 * * *': 'Her gün 10:00',
179
- '0 18 * * *': 'Her gün 18:00',
180
- '0 9 * * 1': 'Her Pazartesi 09:00',
181
- '0 */2 * * *': 'Her 2 saatte bir'
182
- };
183
- return mappings[cron] || cron;
184
- }
185
- }
186
-
187
- export const schedulerTool = {
188
- name: 'schedule',
189
-
190
- async execute(params, context) {
191
- const { action, task, schedule, jobId, enabled } = params;
192
- const scheduler = new SchedulerService(context.api);
193
-
194
- switch (action) {
195
- case 'add':
196
- case 'ekle':
197
- if (TASK_TEMPLATES[task]) {
198
- return await scheduler.addPreset(task, schedule);
199
- } else {
200
- return await scheduler.addJob({ id: jobId || `vantuz-${Date.now()}`, schedule, prompt: task });
201
- }
202
-
203
- case 'remove':
204
- case 'sil':
205
- return await scheduler.removeJob(jobId);
206
-
207
- case 'run':
208
- case 'calistir':
209
- return await scheduler.runNow(jobId);
210
-
211
- case 'toggle':
212
- case 'degistir':
213
- return await scheduler.toggleJob(jobId, enabled);
214
-
215
- case 'list':
216
- case 'listele':
217
- return await scheduler.listJobs();
218
-
219
- case 'templates':
220
- case 'sablonlar':
221
- return { success: true, templates: scheduler.getTemplates() };
222
-
223
- default:
224
- return {
225
- success: false,
226
- error: 'Geçersiz action. Kullanım: add, remove, run, toggle, list, templates'
227
- };
228
- }
229
- }
230
- };
231
-
232
- export default SchedulerService;
1
+ /**
2
+ * ⏰ CRON ZAMANLAYICI
3
+ * Vantuz cron entegrasyonu ile otomatik görevler
4
+ */
5
+
6
+ const PRESETS = {
7
+ '15dk': '*/15 * * * *', // Her 15 dakikada
8
+ '30dk': '*/30 * * * *', // Her 30 dakikada
9
+ 'saatlik': '0 * * * *', // Her saat başı
10
+ 'gunluk-9': '0 9 * * *', // Her gün 09:00
11
+ 'gunluk-18': '0 18 * * *', // Her gün 18:00
12
+ 'haftalik': '0 9 * * 1', // Pazartesi 09:00
13
+ 'aylik': '0 9 1 * *' // Ayın 1'i 09:00
14
+ };
15
+
16
+ const TASK_TEMPLATES = {
17
+ 'rakip-kontrol': {
18
+ prompt: 'Tüm ürünlerin rakip fiyatlarını kontrol et ve avantaj/dezavantaj durumunu raporla',
19
+ defaultSchedule: '*/15 * * * *'
20
+ },
21
+ 'stok-uyari': {
22
+ prompt: 'Stoku 5 ve altına düşen ürünleri tespit et ve kritik olanları bildir',
23
+ defaultSchedule: '0 */2 * * *'
24
+ },
25
+ 'gunluk-rapor': {
26
+ prompt: 'Günlük satış özeti hazırla: toplam ciro, sipariş sayısı, en çok satanlar',
27
+ defaultSchedule: '0 18 * * *'
28
+ },
29
+ 'haftalik-analiz': {
30
+ prompt: 'Haftalık performans analizi: satış trendi, kar marjı, en iyi/kötü ürünler',
31
+ defaultSchedule: '0 9 * * 1'
32
+ },
33
+ 'fiyat-optimizasyon': {
34
+ prompt: 'Düşük satış hızlı ürünlerde fiyat optimizasyonu öner',
35
+ defaultSchedule: '0 10 * * *'
36
+ },
37
+ 'yorum-analiz': {
38
+ prompt: 'Son 24 saatteki olumsuz yorumları analiz et ve aksiyon öner',
39
+ defaultSchedule: '0 9 * * *'
40
+ }
41
+ };
42
+
43
+ export class SchedulerService {
44
+ constructor(api) {
45
+ this.api = api;
46
+ this.jobs = new Map();
47
+ }
48
+
49
+ /**
50
+ * Hazır şablon ekle
51
+ */
52
+ async addPreset(taskName, customSchedule = null) {
53
+ const template = TASK_TEMPLATES[taskName];
54
+ if (!template) {
55
+ return { success: false, error: `Bilinmeyen görev: ${taskName}` };
56
+ }
57
+
58
+ const schedule = customSchedule || template.defaultSchedule;
59
+ return await this.addJob({
60
+ id: `vantuz-${taskName}`,
61
+ schedule,
62
+ prompt: template.prompt
63
+ });
64
+ }
65
+
66
+ /**
67
+ * Özel görev ekle
68
+ */
69
+ async addJob(job) {
70
+ const { id, schedule, prompt, enabled = true } = job;
71
+
72
+ // Cron ifadesini çöz
73
+ const cronSchedule = PRESETS[schedule] || schedule;
74
+
75
+ try {
76
+ if (this.api.cron) {
77
+ await this.api.cron.add({
78
+ id,
79
+ schedule: cronSchedule,
80
+ action: {
81
+ type: 'agent',
82
+ prompt: prompt
83
+ },
84
+ enabled
85
+ });
86
+ }
87
+
88
+ this.jobs.set(id, { ...job, cronSchedule });
89
+ return { success: true, jobId: id };
90
+ } catch (error) {
91
+ return { success: false, error: error.message };
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Görev sil
97
+ */
98
+ async removeJob(jobId) {
99
+ try {
100
+ if (this.api.cron) {
101
+ await this.api.cron.remove({ jobId });
102
+ }
103
+ this.jobs.delete(jobId);
104
+ return { success: true };
105
+ } catch (error) {
106
+ return { success: false, error: error.message };
107
+ }
108
+ }
109
+
110
+ /**
111
+ * Görevi hemen çalıştır
112
+ */
113
+ async runNow(jobId) {
114
+ try {
115
+ if (this.api.cron) {
116
+ await this.api.cron.run({ jobId });
117
+ }
118
+ return { success: true };
119
+ } catch (error) {
120
+ return { success: false, error: error.message };
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Görevi duraklat/devam ettir
126
+ */
127
+ async toggleJob(jobId, enabled) {
128
+ try {
129
+ if (this.api.cron) {
130
+ await this.api.cron.update({ jobId, patch: { enabled } });
131
+ }
132
+ const job = this.jobs.get(jobId);
133
+ if (job) {
134
+ job.enabled = enabled;
135
+ }
136
+ return { success: true };
137
+ } catch (error) {
138
+ return { success: false, error: error.message };
139
+ }
140
+ }
141
+
142
+ /**
143
+ * Tüm görevleri listele
144
+ */
145
+ async listJobs() {
146
+ try {
147
+ if (this.api.cron) {
148
+ const result = await this.api.cron.list();
149
+ return { success: true, jobs: result };
150
+ }
151
+ return { success: true, jobs: Array.from(this.jobs.values()) };
152
+ } catch (error) {
153
+ return { success: false, error: error.message };
154
+ }
155
+ }
156
+
157
+ /**
158
+ * Mevcut şablonları listele
159
+ */
160
+ getTemplates() {
161
+ return Object.entries(TASK_TEMPLATES).map(([key, val]) => ({
162
+ name: key,
163
+ description: val.prompt,
164
+ schedule: val.defaultSchedule,
165
+ scheduleHuman: this.cronToHuman(val.defaultSchedule)
166
+ }));
167
+ }
168
+
169
+ /**
170
+ * Cron ifadesini insan diline çevir
171
+ */
172
+ cronToHuman(cron) {
173
+ const mappings = {
174
+ '*/15 * * * *': 'Her 15 dakikada bir',
175
+ '*/30 * * * *': 'Her 30 dakikada bir',
176
+ '0 * * * *': 'Her saat başı',
177
+ '0 9 * * *': 'Her gün 09:00',
178
+ '0 10 * * *': 'Her gün 10:00',
179
+ '0 18 * * *': 'Her gün 18:00',
180
+ '0 9 * * 1': 'Her Pazartesi 09:00',
181
+ '0 */2 * * *': 'Her 2 saatte bir'
182
+ };
183
+ return mappings[cron] || cron;
184
+ }
185
+ }
186
+
187
+ export const schedulerTool = {
188
+ name: 'schedule',
189
+
190
+ async execute(params, context) {
191
+ const { action, task, schedule, jobId, enabled } = params;
192
+ const scheduler = new SchedulerService(context.api);
193
+
194
+ switch (action) {
195
+ case 'add':
196
+ case 'ekle':
197
+ if (TASK_TEMPLATES[task]) {
198
+ return await scheduler.addPreset(task, schedule);
199
+ } else {
200
+ return await scheduler.addJob({ id: jobId || `vantuz-${Date.now()}`, schedule, prompt: task });
201
+ }
202
+
203
+ case 'remove':
204
+ case 'sil':
205
+ return await scheduler.removeJob(jobId);
206
+
207
+ case 'run':
208
+ case 'calistir':
209
+ return await scheduler.runNow(jobId);
210
+
211
+ case 'toggle':
212
+ case 'degistir':
213
+ return await scheduler.toggleJob(jobId, enabled);
214
+
215
+ case 'list':
216
+ case 'listele':
217
+ return await scheduler.listJobs();
218
+
219
+ case 'templates':
220
+ case 'sablonlar':
221
+ return { success: true, templates: scheduler.getTemplates() };
222
+
223
+ default:
224
+ return {
225
+ success: false,
226
+ error: 'Geçersiz action. Kullanım: add, remove, run, toggle, list, templates'
227
+ };
228
+ }
229
+ }
230
+ };
231
+
232
+ export default SchedulerService;