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.
- package/LICENSE +45 -45
- package/admin-keygen.js +51 -0
- package/cli.js +685 -585
- package/config.js +733 -733
- package/core/agent-loop.js +190 -190
- package/core/ai-provider.js +298 -261
- package/core/automation.js +523 -523
- package/core/brand-analyst.js +101 -0
- package/core/channels.js +167 -167
- package/core/dashboard.js +230 -230
- package/core/database.js +135 -36
- package/core/eia-monitor.js +3 -1
- package/core/engine.js +648 -636
- package/core/gateway.js +447 -447
- package/core/learning.js +214 -214
- package/core/license.js +113 -0
- package/core/marketplace-adapter.js +168 -168
- package/core/memory.js +190 -190
- package/core/migrations/001-initial-schema.sql +1 -1
- package/core/queue.js +120 -120
- package/core/self-healer.js +314 -314
- package/core/unified-product.js +214 -214
- package/core/vision-service.js +113 -113
- package/index.js +217 -174
- package/modules/crm/sentiment-crm.js +231 -231
- package/modules/healer/listing-healer.js +201 -201
- package/modules/oracle/predictor.js +214 -214
- package/modules/researcher/agent.js +169 -169
- package/modules/team/agents/base.js +92 -92
- package/modules/team/agents/dev.js +33 -33
- package/modules/team/agents/josh.js +40 -40
- package/modules/team/agents/marketing.js +33 -33
- package/modules/team/agents/milo.js +36 -36
- package/modules/team/index.js +78 -78
- package/modules/team/shared-memory.js +87 -87
- package/modules/war-room/competitor-tracker.js +250 -250
- package/modules/war-room/pricing-engine.js +308 -308
- package/nodes/warehouse.js +238 -238
- package/onboard.js +1 -1
- package/package.json +7 -6
- package/platforms/pttavm.js +14 -14
- package/plugins/vantuz/index.js +528 -528
- package/plugins/vantuz/memory/hippocampus.js +465 -464
- package/plugins/vantuz/package.json +20 -20
- package/plugins/vantuz/platforms/_template.js +118 -118
- package/plugins/vantuz/platforms/amazon.js +236 -236
- package/plugins/vantuz/platforms/ciceksepeti.js +166 -166
- package/plugins/vantuz/platforms/hepsiburada.js +180 -180
- package/plugins/vantuz/platforms/index.js +165 -165
- package/plugins/vantuz/platforms/n11.js +229 -229
- package/plugins/vantuz/platforms/pazarama.js +154 -154
- package/plugins/vantuz/platforms/pttavm.js +127 -127
- package/plugins/vantuz/platforms/trendyol.js +326 -326
- package/plugins/vantuz/services/alerts.js +253 -253
- package/plugins/vantuz/services/license.js +34 -34
- package/plugins/vantuz/services/scheduler.js +232 -232
- package/plugins/vantuz/tools/analytics.js +152 -152
- package/plugins/vantuz/tools/crossborder.js +187 -187
- package/plugins/vantuz/tools/nl-parser.js +211 -211
- package/plugins/vantuz/tools/product.js +110 -110
- package/plugins/vantuz/tools/quick-report.js +175 -175
- package/plugins/vantuz/tools/repricer.js +314 -314
- package/plugins/vantuz/tools/sentiment.js +115 -115
- package/plugins/vantuz/tools/vision.js +257 -257
- package/private.pem +28 -0
- package/public.pem +9 -0
- package/server/app.js +260 -260
- package/server/public/index.html +514 -514
- package/start.bat +33 -33
- package/vantuz.sqlite +0 -0
package/plugins/vantuz/index.js
CHANGED
|
@@ -1,528 +1,528 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* π VANTUZ AI v3.1
|
|
3
|
-
* E-Ticaretin Yapay Zeka Beyni
|
|
4
|
-
*
|
|
5
|
-
* Bu plugin ΕunlarΔ± saΔlar:
|
|
6
|
-
* - 7 Pazaryeri API Entegrasyonu (Trendyol, HB, N11, Amazon, CS, PTT, Pazarama)
|
|
7
|
-
* - E-ticaret araΓ§larΔ± (repricer, vision, sentiment, crossborder)
|
|
8
|
-
* - Γzel komutlar (/stok, /fiyat, /rapor, /uyari)
|
|
9
|
-
* - Cron zamanlama ve otomasyon
|
|
10
|
-
* - Hippocampus hafΔ±za sistemi
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { Hippocampus } from './memory/hippocampus.js';
|
|
14
|
-
import { LicenseManager } from './services/license.js';
|
|
15
|
-
import SchedulerService from './services/scheduler.js';
|
|
16
|
-
import AlertService from './services/alerts.js';
|
|
17
|
-
|
|
18
|
-
// Tools
|
|
19
|
-
import { repricerTool } from './tools/repricer.js';
|
|
20
|
-
import { visionTool } from './tools/vision.js';
|
|
21
|
-
import { sentimentTool } from './tools/sentiment.js';
|
|
22
|
-
import { crossborderTool } from './tools/crossborder.js';
|
|
23
|
-
import { productTool } from './tools/product.js';
|
|
24
|
-
import { analyticsTool } from './tools/analytics.js';
|
|
25
|
-
import { quickReportTool } from './tools/quick-report.js';
|
|
26
|
-
import NLParser from './tools/nl-parser.js';
|
|
27
|
-
|
|
28
|
-
// Platform APIs
|
|
29
|
-
import platformHub, {
|
|
30
|
-
trendyolApi,
|
|
31
|
-
hepsiburadaApi,
|
|
32
|
-
n11Api,
|
|
33
|
-
amazonApi,
|
|
34
|
-
ciceksepetiApi,
|
|
35
|
-
pttavmApi,
|
|
36
|
-
pazaramaApi
|
|
37
|
-
} from './platforms/index.js';
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const PLUGIN_ID = 'vantuz';
|
|
41
|
-
const PLUGIN_VERSION = '3.0.0';
|
|
42
|
-
|
|
43
|
-
export default function (api) {
|
|
44
|
-
const logger = api.logger;
|
|
45
|
-
const config = api.config;
|
|
46
|
-
|
|
47
|
-
// Hippocampus hafΔ±za sistemi
|
|
48
|
-
const memory = new Hippocampus(api);
|
|
49
|
-
|
|
50
|
-
// Lisans yΓΆneticisi
|
|
51
|
-
const license = new LicenseManager(api);
|
|
52
|
-
|
|
53
|
-
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
54
|
-
// π§ TOOLS - AI tarafΔ±ndan Γ§aΔrΔ±labilir araΓ§lar
|
|
55
|
-
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
56
|
-
|
|
57
|
-
// π©Έ Kan Emici Repricer
|
|
58
|
-
api.registerTool({
|
|
59
|
-
name: 'vantuz.repricer',
|
|
60
|
-
description: `Rakip fiyatlarΔ±nΔ± analiz et ve optimal fiyat ΓΆner.
|
|
61
|
-
AkΔ±llΔ± kararlar verir:
|
|
62
|
-
- Rakip stoku azsa β FiyatΔ± yΓΌkselt
|
|
63
|
-
- Rakip fiyat dΓΌΕΓΌrdΓΌyse β Kar marjΔ±na gΓΆre takip et
|
|
64
|
-
- SatΔ±Ε hΔ±zΔ± yΓΌksekse β FiyatΔ± optimize et`,
|
|
65
|
-
parameters: {
|
|
66
|
-
type: 'object',
|
|
67
|
-
properties: {
|
|
68
|
-
barcode: {
|
|
69
|
-
type: 'string',
|
|
70
|
-
description: 'ΓrΓΌn barkodu veya SKU'
|
|
71
|
-
},
|
|
72
|
-
platform: {
|
|
73
|
-
type: 'string',
|
|
74
|
-
enum: ['trendyol', 'hepsiburada', 'amazon', 'n11', 'all'],
|
|
75
|
-
description: 'Hedef pazaryeri'
|
|
76
|
-
},
|
|
77
|
-
targetMargin: {
|
|
78
|
-
type: 'number',
|
|
79
|
-
description: 'Hedef kar marjΔ± yΓΌzdesi (ΓΆrn: 20)'
|
|
80
|
-
},
|
|
81
|
-
action: {
|
|
82
|
-
type: 'string',
|
|
83
|
-
enum: ['analyze', 'apply', 'schedule'],
|
|
84
|
-
description: 'Sadece analiz, uygula veya zamanla'
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
required: ['barcode']
|
|
88
|
-
},
|
|
89
|
-
handler: async (params) => repricerTool.execute(params, { api, memory, license })
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// ποΈ Vision AI
|
|
93
|
-
api.registerTool({
|
|
94
|
-
name: 'vantuz.vision',
|
|
95
|
-
description: `FotoΔraftan ΓΌrΓΌn bilgisi Γ§Δ±kar ve pazaryerlerine ekle.
|
|
96
|
-
- SEO uyumlu baΕlΔ±k oluΕturur
|
|
97
|
-
- DetaylΔ± aΓ§Δ±klama yazar
|
|
98
|
-
- Kategori eΕleΕtirir (5 pazaryeri iΓ§in)
|
|
99
|
-
- Tahmini fiyat ΓΆnerir`,
|
|
100
|
-
parameters: {
|
|
101
|
-
type: 'object',
|
|
102
|
-
properties: {
|
|
103
|
-
imageUrl: {
|
|
104
|
-
type: 'string',
|
|
105
|
-
description: 'ΓrΓΌn fotoΔrafΔ± URL veya base64'
|
|
106
|
-
},
|
|
107
|
-
targetPlatforms: {
|
|
108
|
-
type: 'array',
|
|
109
|
-
items: { type: 'string' },
|
|
110
|
-
description: 'Hedef pazaryerleri: trendyol, hepsiburada, amazon_de, amazon_us, n11'
|
|
111
|
-
},
|
|
112
|
-
autoPublish: {
|
|
113
|
-
type: 'boolean',
|
|
114
|
-
description: 'Otomatik yayΔ±nla (true) veya ΓΆnizleme (false)'
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
required: ['imageUrl']
|
|
118
|
-
},
|
|
119
|
-
handler: async (params) => visionTool.execute(params, { api, memory, license })
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
// π§ Sentiment AI
|
|
123
|
-
api.registerTool({
|
|
124
|
-
name: 'vantuz.sentiment',
|
|
125
|
-
description: `MΓΌΕteri yorumlarΔ±nΔ± analiz et ve aksiyon ΓΆner.
|
|
126
|
-
- Pozitif/negatif oranlarΔ±
|
|
127
|
-
- Ana Εikayet konularΔ± tespit
|
|
128
|
-
- TedarikΓ§i kalite sorunlarΔ±
|
|
129
|
-
- Otomatik yanΔ±t ΓΆnerileri`,
|
|
130
|
-
parameters: {
|
|
131
|
-
type: 'object',
|
|
132
|
-
properties: {
|
|
133
|
-
productId: {
|
|
134
|
-
type: 'string',
|
|
135
|
-
description: 'ΓrΓΌn ID veya barkod'
|
|
136
|
-
},
|
|
137
|
-
platform: {
|
|
138
|
-
type: 'string',
|
|
139
|
-
enum: ['trendyol', 'hepsiburada', 'amazon', 'n11', 'all'],
|
|
140
|
-
description: 'Pazaryeri'
|
|
141
|
-
},
|
|
142
|
-
period: {
|
|
143
|
-
type: 'string',
|
|
144
|
-
enum: ['7d', '30d', '90d', 'all'],
|
|
145
|
-
description: 'Analiz dΓΆnemi'
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
required: ['productId']
|
|
149
|
-
},
|
|
150
|
-
handler: async (params) => sentimentTool.execute(params, { api, memory, license })
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
// π Cross-Border
|
|
154
|
-
api.registerTool({
|
|
155
|
-
name: 'vantuz.crossborder',
|
|
156
|
-
description: `ΓrΓΌnΓΌ yurt dΔ±ΕΔ± pazarΔ±na uyarla ve sat.
|
|
157
|
-
- Dil Γ§evirisi (Almanca, Δ°ngilizce)
|
|
158
|
-
- DΓΆviz hesaplama
|
|
159
|
-
- Kargo + FBA komisyon hesabΔ±
|
|
160
|
-
- Optimal satΔ±Ε fiyatΔ±`,
|
|
161
|
-
parameters: {
|
|
162
|
-
type: 'object',
|
|
163
|
-
properties: {
|
|
164
|
-
productId: {
|
|
165
|
-
type: 'string',
|
|
166
|
-
description: 'Kaynak ΓΌrΓΌn ID veya barkod'
|
|
167
|
-
},
|
|
168
|
-
sourcePlatform: {
|
|
169
|
-
type: 'string',
|
|
170
|
-
enum: ['trendyol', 'hepsiburada', 'n11'],
|
|
171
|
-
description: 'Kaynak pazaryeri'
|
|
172
|
-
},
|
|
173
|
-
targetMarket: {
|
|
174
|
-
type: 'string',
|
|
175
|
-
enum: ['de', 'us', 'uk', 'fr'],
|
|
176
|
-
description: 'Hedef pazar'
|
|
177
|
-
},
|
|
178
|
-
fulfillment: {
|
|
179
|
-
type: 'string',
|
|
180
|
-
enum: ['fba', 'fbm', 'self'],
|
|
181
|
-
description: 'Fulfillment yΓΆntemi'
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
required: ['productId', 'targetMarket']
|
|
185
|
-
},
|
|
186
|
-
handler: async (params) => crossborderTool.execute(params, { api, memory, license })
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
// π¦ ΓrΓΌn YΓΆnetimi
|
|
190
|
-
api.registerTool({
|
|
191
|
-
name: 'vantuz.product',
|
|
192
|
-
description: `ΓrΓΌn iΕlemleri: liste, gΓΌncelle, stok, fiyat.`,
|
|
193
|
-
parameters: {
|
|
194
|
-
type: 'object',
|
|
195
|
-
properties: {
|
|
196
|
-
action: {
|
|
197
|
-
type: 'string',
|
|
198
|
-
enum: ['list', 'get', 'update', 'updatePrice', 'updateStock', 'publish', 'unpublish'],
|
|
199
|
-
description: 'YapΔ±lacak iΕlem'
|
|
200
|
-
},
|
|
201
|
-
productId: { type: 'string' },
|
|
202
|
-
platform: { type: 'string' },
|
|
203
|
-
data: { type: 'object', description: 'GΓΌncelleme verisi' }
|
|
204
|
-
},
|
|
205
|
-
required: ['action']
|
|
206
|
-
},
|
|
207
|
-
handler: async (params) => productTool.execute(params, { api, memory, license })
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
// π Analitik
|
|
211
|
-
api.registerTool({
|
|
212
|
-
name: 'vantuz.analytics',
|
|
213
|
-
description: `SatΔ±Ε, stok ve performans raporlarΔ±.`,
|
|
214
|
-
parameters: {
|
|
215
|
-
type: 'object',
|
|
216
|
-
properties: {
|
|
217
|
-
reportType: {
|
|
218
|
-
type: 'string',
|
|
219
|
-
enum: ['sales', 'stock', 'profit', 'competitors', 'trends'],
|
|
220
|
-
description: 'Rapor tΓΌrΓΌ'
|
|
221
|
-
},
|
|
222
|
-
platform: { type: 'string' },
|
|
223
|
-
period: {
|
|
224
|
-
type: 'string',
|
|
225
|
-
enum: ['today', '7d', '30d', '90d'],
|
|
226
|
-
description: 'DΓΆnem'
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
required: ['reportType']
|
|
230
|
-
},
|
|
231
|
-
handler: async (params) => analyticsTool.execute(params, { api, memory, license })
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
// π§ HafΔ±za Arama
|
|
235
|
-
api.registerTool({
|
|
236
|
-
name: 'vantuz.memory_search',
|
|
237
|
-
description: `Hippocampus hafΔ±za sisteminde arama yap.
|
|
238
|
-
GeΓ§miΕ kararlarΔ±, fiyat deΔiΕikliklerini, ΓΌrΓΌn geΓ§miΕini sorgula.`,
|
|
239
|
-
parameters: {
|
|
240
|
-
type: 'object',
|
|
241
|
-
properties: {
|
|
242
|
-
query: { type: 'string', description: 'Arama sorgusu' },
|
|
243
|
-
type: {
|
|
244
|
-
type: 'string',
|
|
245
|
-
enum: ['decision', 'price_change', 'product', 'conversation', 'all'],
|
|
246
|
-
description: 'HafΔ±za tΓΌrΓΌ'
|
|
247
|
-
},
|
|
248
|
-
limit: { type: 'number', description: 'Maksimum sonuΓ§' }
|
|
249
|
-
},
|
|
250
|
-
required: ['query']
|
|
251
|
-
},
|
|
252
|
-
handler: async (params) => memory.search(params)
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
256
|
-
// π COMMANDS - KullanΔ±cΔ± tarafΔ±ndan doΔrudan Γ§aΔrΔ±lan komutlar
|
|
257
|
-
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
258
|
-
|
|
259
|
-
api.registerCommand({
|
|
260
|
-
name: 'stok',
|
|
261
|
-
description: 'Stok durumunu gΓΆster',
|
|
262
|
-
acceptsArgs: true,
|
|
263
|
-
handler: async (ctx) => {
|
|
264
|
-
const platform = ctx.args?.trim() || 'all';
|
|
265
|
-
const stocks = await productTool.getStockSummary(platform, { api, memory });
|
|
266
|
-
return { text: formatStockReport(stocks) };
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
api.registerCommand({
|
|
271
|
-
name: 'fiyat',
|
|
272
|
-
description: 'ΓrΓΌn fiyatΔ±nΔ± gΓΌncelle',
|
|
273
|
-
acceptsArgs: true,
|
|
274
|
-
handler: async (ctx) => {
|
|
275
|
-
// Parse: "iPhone kΔ±lΔ±f 199 TL" veya "SKU-123 %10 indirim"
|
|
276
|
-
const result = await productTool.parseAndUpdatePrice(ctx.args, { api, memory });
|
|
277
|
-
return { text: result.message };
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
api.registerCommand({
|
|
282
|
-
name: 'rapor',
|
|
283
|
-
description: 'SatΔ±Ε raporu gΓΆster',
|
|
284
|
-
acceptsArgs: true,
|
|
285
|
-
handler: async (ctx) => {
|
|
286
|
-
const period = ctx.args?.trim() || '7d';
|
|
287
|
-
const report = await analyticsTool.getSalesReport(period, { api, memory });
|
|
288
|
-
return { text: formatSalesReport(report) };
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
api.registerCommand({
|
|
293
|
-
name: 'rakip',
|
|
294
|
-
description: 'Rakip fiyatlarΔ±nΔ± kontrol et',
|
|
295
|
-
acceptsArgs: true,
|
|
296
|
-
handler: async (ctx) => {
|
|
297
|
-
const barcode = ctx.args?.trim();
|
|
298
|
-
if (!barcode) return { text: 'β Barkod veya ΓΌrΓΌn adΔ± belirtin.' };
|
|
299
|
-
const result = await repricerTool.analyzeCompetitors(barcode, { api, memory });
|
|
300
|
-
return { text: formatCompetitorReport(result) };
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
api.registerCommand({
|
|
305
|
-
name: 'lisans',
|
|
306
|
-
description: 'Lisans durumunu gΓΆster',
|
|
307
|
-
handler: async () => {
|
|
308
|
-
const status = await license.getStatus();
|
|
309
|
-
return { text: formatLicenseStatus(status) };
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
api.registerCommand({
|
|
314
|
-
name: 'uyari',
|
|
315
|
-
description: 'UyarΔ±larΔ± gΓΆster',
|
|
316
|
-
handler: async () => {
|
|
317
|
-
const alerts = alertService.alerts.filter(a => !a.read);
|
|
318
|
-
return { text: alertService.formatAlerts(alerts) };
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
api.registerCommand({
|
|
323
|
-
name: 'zamanlama',
|
|
324
|
-
description: 'ZamanlanmΔ±Ε gΓΆrevleri gΓΆster',
|
|
325
|
-
acceptsArgs: true,
|
|
326
|
-
handler: async (ctx) => {
|
|
327
|
-
if (ctx.args?.includes('ekle')) {
|
|
328
|
-
const templates = scheduler.getTemplates();
|
|
329
|
-
let msg = 'π
**HazΔ±r Εablonlar**\n\n';
|
|
330
|
-
templates.forEach(t => {
|
|
331
|
-
msg += `β’ \`${t.name}\`: ${t.scheduleHuman}\n`;
|
|
332
|
-
});
|
|
333
|
-
msg += '\n*Eklemek iΓ§in: /zamanlama ekle [Εablon]*';
|
|
334
|
-
return { text: msg };
|
|
335
|
-
}
|
|
336
|
-
const jobs = await scheduler.listJobs();
|
|
337
|
-
return { text: formatScheduleList(jobs) };
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
api.registerCommand({
|
|
342
|
-
name: 'platformlar',
|
|
343
|
-
description: 'BaΔlΔ± platformlarΔ± gΓΆster',
|
|
344
|
-
handler: async () => {
|
|
345
|
-
const result = quickReportTool.generatePlatformStatus();
|
|
346
|
-
return { text: result.report };
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
// π₯ Multi-Agent Team Command
|
|
351
|
-
api.registerCommand({
|
|
352
|
-
name: 'team',
|
|
353
|
-
description: 'Yapay Zeka TakΔ±mΔ± ile konuΕ (Milo, Josh, Marketing, Dev)',
|
|
354
|
-
acceptsArgs: true,
|
|
355
|
-
handler: async (ctx) => {
|
|
356
|
-
// Lazy load to avoid circular deps or early init issues
|
|
357
|
-
const TeamModule = (await import('../../modules/team/index.js')).default;
|
|
358
|
-
const team = new TeamModule(api);
|
|
359
|
-
await team.initialize();
|
|
360
|
-
|
|
361
|
-
const args = ctx.args ? ctx.args.trim().split(' ') : [];
|
|
362
|
-
const subCommand = args[0];
|
|
363
|
-
|
|
364
|
-
if (!subCommand) {
|
|
365
|
-
return { text: 'Komutlar: /team chat [agent] [mesaj], /team status, /team broadcast [mesaj]' };
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
if (subCommand === 'chat') {
|
|
369
|
-
const agentName = args[1];
|
|
370
|
-
const message = args.slice(2).join(' ');
|
|
371
|
-
if (!agentName || !message) return { text: 'KullanΔ±m: /team chat [milo|josh|marketing|dev] [mesaj]' };
|
|
372
|
-
|
|
373
|
-
const response = await team.chat(agentName, message);
|
|
374
|
-
return { text: `**@${agentName}**: ${response}` };
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
if (subCommand === 'broadcast') {
|
|
378
|
-
const message = args.slice(1).join(' ');
|
|
379
|
-
if (!message) return { text: 'Mesaj yazΔ±n.' };
|
|
380
|
-
|
|
381
|
-
const results = await team.broadcast(message);
|
|
382
|
-
let report = 'π’ **TakΔ±m YanΔ±tlarΔ±**\n\n';
|
|
383
|
-
for (const [name, res] of Object.entries(results)) {
|
|
384
|
-
report += `**@${name}**: ${res}\n\n`;
|
|
385
|
-
}
|
|
386
|
-
return { text: report };
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
if (subCommand === 'status') {
|
|
390
|
-
const memory = team.getSharedMemory().getEverything();
|
|
391
|
-
return { text: `π **TakΔ±m Durumu**\n\n**Hedefler:**\n${memory.goals}\n\n**Durum:**\n${memory.status}` };
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
return { text: 'GeΓ§ersiz komut. KullanΔ±labilir: chat, broadcast, status' };
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
|
-
|
|
398
|
-
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
399
|
-
// βοΈ SERVICES - Arka plan servisleri
|
|
400
|
-
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
401
|
-
|
|
402
|
-
// Lisans DoΔrulama Servisi
|
|
403
|
-
api.registerService({
|
|
404
|
-
id: 'vantuz-license',
|
|
405
|
-
start: async () => {
|
|
406
|
-
logger.info('π Lisans servisi baΕlatΔ±lΔ±yor...');
|
|
407
|
-
await license.initialize();
|
|
408
|
-
|
|
409
|
-
// Her 24 saatte bir lisans kontrolΓΌ
|
|
410
|
-
setInterval(() => license.verify(), 24 * 60 * 60 * 1000);
|
|
411
|
-
},
|
|
412
|
-
stop: () => {
|
|
413
|
-
logger.info('π Lisans servisi durduruluyor...');
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
|
|
417
|
-
// Hippocampus HafΔ±za Servisi
|
|
418
|
-
api.registerService({
|
|
419
|
-
id: 'vantuz-memory',
|
|
420
|
-
start: async () => {
|
|
421
|
-
logger.info('π§ Hippocampus hafΔ±za sistemi baΕlatΔ±lΔ±yor...');
|
|
422
|
-
await memory.initialize();
|
|
423
|
-
},
|
|
424
|
-
stop: async () => {
|
|
425
|
-
logger.info('π§ Hippocampus kapatΔ±lΔ±yor...');
|
|
426
|
-
await memory.close();
|
|
427
|
-
}
|
|
428
|
-
});
|
|
429
|
-
|
|
430
|
-
// Repricer Daemon (Arka planda fiyat kontrolΓΌ)
|
|
431
|
-
api.registerService({
|
|
432
|
-
id: 'vantuz-repricer-daemon',
|
|
433
|
-
start: () => {
|
|
434
|
-
logger.info('π©Έ Kan Emici Repricer daemon baΕlatΔ±lΔ±yor...');
|
|
435
|
-
|
|
436
|
-
// Her 15 dakikada bir fiyat kontrolΓΌ
|
|
437
|
-
const interval = setInterval(async () => {
|
|
438
|
-
if (!license.isValid()) return;
|
|
439
|
-
|
|
440
|
-
try {
|
|
441
|
-
const decisions = await repricerTool.runAutoCycle({ api, memory, license });
|
|
442
|
-
if (decisions.length > 0) {
|
|
443
|
-
logger.info(`π° ${decisions.length} fiyat kararΔ± alΔ±ndΔ±.`);
|
|
444
|
-
}
|
|
445
|
-
} catch (err) {
|
|
446
|
-
logger.error('Repricer hatasΔ±:', err);
|
|
447
|
-
}
|
|
448
|
-
}, 15 * 60 * 1000);
|
|
449
|
-
|
|
450
|
-
// Store interval for cleanup
|
|
451
|
-
this._repricerInterval = interval;
|
|
452
|
-
},
|
|
453
|
-
stop: () => {
|
|
454
|
-
if (this._repricerInterval) {
|
|
455
|
-
clearInterval(this._repricerInterval);
|
|
456
|
-
}
|
|
457
|
-
logger.info('π©Έ Repricer daemon durduruluyor...');
|
|
458
|
-
}
|
|
459
|
-
});
|
|
460
|
-
|
|
461
|
-
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
462
|
-
// π GATEWAY RPC - Harici API metodlarΔ±
|
|
463
|
-
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
464
|
-
|
|
465
|
-
api.registerGatewayMethod('vantuz.status', ({ respond }) => {
|
|
466
|
-
respond(true, {
|
|
467
|
-
version: PLUGIN_VERSION,
|
|
468
|
-
license: license.getStatus(),
|
|
469
|
-
memory: memory.getStats(),
|
|
470
|
-
platforms: platformHub.getStatus()
|
|
471
|
-
});
|
|
472
|
-
});
|
|
473
|
-
|
|
474
|
-
api.registerGatewayMethod('vantuz.config', ({ respond, params }) => {
|
|
475
|
-
if (params.action === 'get') {
|
|
476
|
-
respond(true, config.get('vantuz') || {});
|
|
477
|
-
} else if (params.action === 'set') {
|
|
478
|
-
config.set('vantuz', params.data);
|
|
479
|
-
respond(true, { success: true });
|
|
480
|
-
}
|
|
481
|
-
});
|
|
482
|
-
|
|
483
|
-
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
484
|
-
// π HELPER FUNCTIONS
|
|
485
|
-
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
486
|
-
|
|
487
|
-
function formatStockReport(stocks) {
|
|
488
|
-
let report = 'π¦ **Stok Durumu**\n\n';
|
|
489
|
-
for (const [platform, data] of Object.entries(stocks)) {
|
|
490
|
-
report += `**${platform}**\n`;
|
|
491
|
-
report += `β’ Toplam: ${data.total} ΓΌrΓΌn\n`;
|
|
492
|
-
report += `β’ Kritik (<5): ${data.critical} ΓΌrΓΌn\n`;
|
|
493
|
-
report += `β’ SΔ±fΔ±r stok: ${data.zero} ΓΌrΓΌn\n\n`;
|
|
494
|
-
}
|
|
495
|
-
return report;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
function formatSalesReport(report) {
|
|
499
|
-
return `π **SatΔ±Ε Raporu (${report.period})**
|
|
500
|
-
|
|
501
|
-
π° Toplam Ciro: ${report.revenue.toLocaleString('tr-TR')} βΊ
|
|
502
|
-
π¦ Toplam SipariΕ: ${report.orders}
|
|
503
|
-
π Ortalama Sepet: ${report.avgBasket.toLocaleString('tr-TR')} βΊ
|
|
504
|
-
π En Γok Satan: ${report.topProduct}`;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
function formatCompetitorReport(result) {
|
|
508
|
-
let report = `π **Rakip Analizi: ${result.product}**\n\n`;
|
|
509
|
-
for (const comp of result.competitors) {
|
|
510
|
-
report += `β’ ${comp.name}: ${comp.price} βΊ (Stok: ${comp.stock})\n`;
|
|
511
|
-
}
|
|
512
|
-
report += `\nπ‘ **Γneri**: ${result.recommendation}`;
|
|
513
|
-
return report;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
function formatLicenseStatus(status) {
|
|
517
|
-
if (!status.valid) {
|
|
518
|
-
return `β **Lisans GeΓ§ersiz**\nNeden: ${status.reason}`;
|
|
519
|
-
}
|
|
520
|
-
return `β
**Lisans Aktif**
|
|
521
|
-
π€ MΓΌΕteri: ${status.customer}
|
|
522
|
-
π
BitiΕ: ${status.expiry}
|
|
523
|
-
β° Kalan: ${status.daysLeft} gΓΌn`;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
// Plugin yΓΌklendi
|
|
527
|
-
logger.info(`π Vantuz AI v${PLUGIN_VERSION} yΓΌklendi!`);
|
|
528
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* π VANTUZ AI v3.1
|
|
3
|
+
* E-Ticaretin Yapay Zeka Beyni
|
|
4
|
+
*
|
|
5
|
+
* Bu plugin ΕunlarΔ± saΔlar:
|
|
6
|
+
* - 7 Pazaryeri API Entegrasyonu (Trendyol, HB, N11, Amazon, CS, PTT, Pazarama)
|
|
7
|
+
* - E-ticaret araΓ§larΔ± (repricer, vision, sentiment, crossborder)
|
|
8
|
+
* - Γzel komutlar (/stok, /fiyat, /rapor, /uyari)
|
|
9
|
+
* - Cron zamanlama ve otomasyon
|
|
10
|
+
* - Hippocampus hafΔ±za sistemi
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { Hippocampus } from './memory/hippocampus.js';
|
|
14
|
+
import { LicenseManager } from './services/license.js';
|
|
15
|
+
import SchedulerService from './services/scheduler.js';
|
|
16
|
+
import AlertService from './services/alerts.js';
|
|
17
|
+
|
|
18
|
+
// Tools
|
|
19
|
+
import { repricerTool } from './tools/repricer.js';
|
|
20
|
+
import { visionTool } from './tools/vision.js';
|
|
21
|
+
import { sentimentTool } from './tools/sentiment.js';
|
|
22
|
+
import { crossborderTool } from './tools/crossborder.js';
|
|
23
|
+
import { productTool } from './tools/product.js';
|
|
24
|
+
import { analyticsTool } from './tools/analytics.js';
|
|
25
|
+
import { quickReportTool } from './tools/quick-report.js';
|
|
26
|
+
import NLParser from './tools/nl-parser.js';
|
|
27
|
+
|
|
28
|
+
// Platform APIs
|
|
29
|
+
import platformHub, {
|
|
30
|
+
trendyolApi,
|
|
31
|
+
hepsiburadaApi,
|
|
32
|
+
n11Api,
|
|
33
|
+
amazonApi,
|
|
34
|
+
ciceksepetiApi,
|
|
35
|
+
pttavmApi,
|
|
36
|
+
pazaramaApi
|
|
37
|
+
} from './platforms/index.js';
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const PLUGIN_ID = 'vantuz';
|
|
41
|
+
const PLUGIN_VERSION = '3.0.0';
|
|
42
|
+
|
|
43
|
+
export default function (api) {
|
|
44
|
+
const logger = api.logger;
|
|
45
|
+
const config = api.config;
|
|
46
|
+
|
|
47
|
+
// Hippocampus hafΔ±za sistemi
|
|
48
|
+
const memory = new Hippocampus(api);
|
|
49
|
+
|
|
50
|
+
// Lisans yΓΆneticisi
|
|
51
|
+
const license = new LicenseManager(api);
|
|
52
|
+
|
|
53
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
54
|
+
// π§ TOOLS - AI tarafΔ±ndan Γ§aΔrΔ±labilir araΓ§lar
|
|
55
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
56
|
+
|
|
57
|
+
// π©Έ Kan Emici Repricer
|
|
58
|
+
api.registerTool({
|
|
59
|
+
name: 'vantuz.repricer',
|
|
60
|
+
description: `Rakip fiyatlarΔ±nΔ± analiz et ve optimal fiyat ΓΆner.
|
|
61
|
+
AkΔ±llΔ± kararlar verir:
|
|
62
|
+
- Rakip stoku azsa β FiyatΔ± yΓΌkselt
|
|
63
|
+
- Rakip fiyat dΓΌΕΓΌrdΓΌyse β Kar marjΔ±na gΓΆre takip et
|
|
64
|
+
- SatΔ±Ε hΔ±zΔ± yΓΌksekse β FiyatΔ± optimize et`,
|
|
65
|
+
parameters: {
|
|
66
|
+
type: 'object',
|
|
67
|
+
properties: {
|
|
68
|
+
barcode: {
|
|
69
|
+
type: 'string',
|
|
70
|
+
description: 'ΓrΓΌn barkodu veya SKU'
|
|
71
|
+
},
|
|
72
|
+
platform: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
enum: ['trendyol', 'hepsiburada', 'amazon', 'n11', 'all'],
|
|
75
|
+
description: 'Hedef pazaryeri'
|
|
76
|
+
},
|
|
77
|
+
targetMargin: {
|
|
78
|
+
type: 'number',
|
|
79
|
+
description: 'Hedef kar marjΔ± yΓΌzdesi (ΓΆrn: 20)'
|
|
80
|
+
},
|
|
81
|
+
action: {
|
|
82
|
+
type: 'string',
|
|
83
|
+
enum: ['analyze', 'apply', 'schedule'],
|
|
84
|
+
description: 'Sadece analiz, uygula veya zamanla'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
required: ['barcode']
|
|
88
|
+
},
|
|
89
|
+
handler: async (params) => repricerTool.execute(params, { api, memory, license })
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// ποΈ Vision AI
|
|
93
|
+
api.registerTool({
|
|
94
|
+
name: 'vantuz.vision',
|
|
95
|
+
description: `FotoΔraftan ΓΌrΓΌn bilgisi Γ§Δ±kar ve pazaryerlerine ekle.
|
|
96
|
+
- SEO uyumlu baΕlΔ±k oluΕturur
|
|
97
|
+
- DetaylΔ± aΓ§Δ±klama yazar
|
|
98
|
+
- Kategori eΕleΕtirir (5 pazaryeri iΓ§in)
|
|
99
|
+
- Tahmini fiyat ΓΆnerir`,
|
|
100
|
+
parameters: {
|
|
101
|
+
type: 'object',
|
|
102
|
+
properties: {
|
|
103
|
+
imageUrl: {
|
|
104
|
+
type: 'string',
|
|
105
|
+
description: 'ΓrΓΌn fotoΔrafΔ± URL veya base64'
|
|
106
|
+
},
|
|
107
|
+
targetPlatforms: {
|
|
108
|
+
type: 'array',
|
|
109
|
+
items: { type: 'string' },
|
|
110
|
+
description: 'Hedef pazaryerleri: trendyol, hepsiburada, amazon_de, amazon_us, n11'
|
|
111
|
+
},
|
|
112
|
+
autoPublish: {
|
|
113
|
+
type: 'boolean',
|
|
114
|
+
description: 'Otomatik yayΔ±nla (true) veya ΓΆnizleme (false)'
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
required: ['imageUrl']
|
|
118
|
+
},
|
|
119
|
+
handler: async (params) => visionTool.execute(params, { api, memory, license })
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// π§ Sentiment AI
|
|
123
|
+
api.registerTool({
|
|
124
|
+
name: 'vantuz.sentiment',
|
|
125
|
+
description: `MΓΌΕteri yorumlarΔ±nΔ± analiz et ve aksiyon ΓΆner.
|
|
126
|
+
- Pozitif/negatif oranlarΔ±
|
|
127
|
+
- Ana Εikayet konularΔ± tespit
|
|
128
|
+
- TedarikΓ§i kalite sorunlarΔ±
|
|
129
|
+
- Otomatik yanΔ±t ΓΆnerileri`,
|
|
130
|
+
parameters: {
|
|
131
|
+
type: 'object',
|
|
132
|
+
properties: {
|
|
133
|
+
productId: {
|
|
134
|
+
type: 'string',
|
|
135
|
+
description: 'ΓrΓΌn ID veya barkod'
|
|
136
|
+
},
|
|
137
|
+
platform: {
|
|
138
|
+
type: 'string',
|
|
139
|
+
enum: ['trendyol', 'hepsiburada', 'amazon', 'n11', 'all'],
|
|
140
|
+
description: 'Pazaryeri'
|
|
141
|
+
},
|
|
142
|
+
period: {
|
|
143
|
+
type: 'string',
|
|
144
|
+
enum: ['7d', '30d', '90d', 'all'],
|
|
145
|
+
description: 'Analiz dΓΆnemi'
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
required: ['productId']
|
|
149
|
+
},
|
|
150
|
+
handler: async (params) => sentimentTool.execute(params, { api, memory, license })
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// π Cross-Border
|
|
154
|
+
api.registerTool({
|
|
155
|
+
name: 'vantuz.crossborder',
|
|
156
|
+
description: `ΓrΓΌnΓΌ yurt dΔ±ΕΔ± pazarΔ±na uyarla ve sat.
|
|
157
|
+
- Dil Γ§evirisi (Almanca, Δ°ngilizce)
|
|
158
|
+
- DΓΆviz hesaplama
|
|
159
|
+
- Kargo + FBA komisyon hesabΔ±
|
|
160
|
+
- Optimal satΔ±Ε fiyatΔ±`,
|
|
161
|
+
parameters: {
|
|
162
|
+
type: 'object',
|
|
163
|
+
properties: {
|
|
164
|
+
productId: {
|
|
165
|
+
type: 'string',
|
|
166
|
+
description: 'Kaynak ΓΌrΓΌn ID veya barkod'
|
|
167
|
+
},
|
|
168
|
+
sourcePlatform: {
|
|
169
|
+
type: 'string',
|
|
170
|
+
enum: ['trendyol', 'hepsiburada', 'n11'],
|
|
171
|
+
description: 'Kaynak pazaryeri'
|
|
172
|
+
},
|
|
173
|
+
targetMarket: {
|
|
174
|
+
type: 'string',
|
|
175
|
+
enum: ['de', 'us', 'uk', 'fr'],
|
|
176
|
+
description: 'Hedef pazar'
|
|
177
|
+
},
|
|
178
|
+
fulfillment: {
|
|
179
|
+
type: 'string',
|
|
180
|
+
enum: ['fba', 'fbm', 'self'],
|
|
181
|
+
description: 'Fulfillment yΓΆntemi'
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
required: ['productId', 'targetMarket']
|
|
185
|
+
},
|
|
186
|
+
handler: async (params) => crossborderTool.execute(params, { api, memory, license })
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
// π¦ ΓrΓΌn YΓΆnetimi
|
|
190
|
+
api.registerTool({
|
|
191
|
+
name: 'vantuz.product',
|
|
192
|
+
description: `ΓrΓΌn iΕlemleri: liste, gΓΌncelle, stok, fiyat.`,
|
|
193
|
+
parameters: {
|
|
194
|
+
type: 'object',
|
|
195
|
+
properties: {
|
|
196
|
+
action: {
|
|
197
|
+
type: 'string',
|
|
198
|
+
enum: ['list', 'get', 'update', 'updatePrice', 'updateStock', 'publish', 'unpublish'],
|
|
199
|
+
description: 'YapΔ±lacak iΕlem'
|
|
200
|
+
},
|
|
201
|
+
productId: { type: 'string' },
|
|
202
|
+
platform: { type: 'string' },
|
|
203
|
+
data: { type: 'object', description: 'GΓΌncelleme verisi' }
|
|
204
|
+
},
|
|
205
|
+
required: ['action']
|
|
206
|
+
},
|
|
207
|
+
handler: async (params) => productTool.execute(params, { api, memory, license })
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
// π Analitik
|
|
211
|
+
api.registerTool({
|
|
212
|
+
name: 'vantuz.analytics',
|
|
213
|
+
description: `SatΔ±Ε, stok ve performans raporlarΔ±.`,
|
|
214
|
+
parameters: {
|
|
215
|
+
type: 'object',
|
|
216
|
+
properties: {
|
|
217
|
+
reportType: {
|
|
218
|
+
type: 'string',
|
|
219
|
+
enum: ['sales', 'stock', 'profit', 'competitors', 'trends'],
|
|
220
|
+
description: 'Rapor tΓΌrΓΌ'
|
|
221
|
+
},
|
|
222
|
+
platform: { type: 'string' },
|
|
223
|
+
period: {
|
|
224
|
+
type: 'string',
|
|
225
|
+
enum: ['today', '7d', '30d', '90d'],
|
|
226
|
+
description: 'DΓΆnem'
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
required: ['reportType']
|
|
230
|
+
},
|
|
231
|
+
handler: async (params) => analyticsTool.execute(params, { api, memory, license })
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
// π§ HafΔ±za Arama
|
|
235
|
+
api.registerTool({
|
|
236
|
+
name: 'vantuz.memory_search',
|
|
237
|
+
description: `Hippocampus hafΔ±za sisteminde arama yap.
|
|
238
|
+
GeΓ§miΕ kararlarΔ±, fiyat deΔiΕikliklerini, ΓΌrΓΌn geΓ§miΕini sorgula.`,
|
|
239
|
+
parameters: {
|
|
240
|
+
type: 'object',
|
|
241
|
+
properties: {
|
|
242
|
+
query: { type: 'string', description: 'Arama sorgusu' },
|
|
243
|
+
type: {
|
|
244
|
+
type: 'string',
|
|
245
|
+
enum: ['decision', 'price_change', 'product', 'conversation', 'all'],
|
|
246
|
+
description: 'HafΔ±za tΓΌrΓΌ'
|
|
247
|
+
},
|
|
248
|
+
limit: { type: 'number', description: 'Maksimum sonuΓ§' }
|
|
249
|
+
},
|
|
250
|
+
required: ['query']
|
|
251
|
+
},
|
|
252
|
+
handler: async (params) => memory.search(params)
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
256
|
+
// π COMMANDS - KullanΔ±cΔ± tarafΔ±ndan doΔrudan Γ§aΔrΔ±lan komutlar
|
|
257
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
258
|
+
|
|
259
|
+
api.registerCommand({
|
|
260
|
+
name: 'stok',
|
|
261
|
+
description: 'Stok durumunu gΓΆster',
|
|
262
|
+
acceptsArgs: true,
|
|
263
|
+
handler: async (ctx) => {
|
|
264
|
+
const platform = ctx.args?.trim() || 'all';
|
|
265
|
+
const stocks = await productTool.getStockSummary(platform, { api, memory });
|
|
266
|
+
return { text: formatStockReport(stocks) };
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
api.registerCommand({
|
|
271
|
+
name: 'fiyat',
|
|
272
|
+
description: 'ΓrΓΌn fiyatΔ±nΔ± gΓΌncelle',
|
|
273
|
+
acceptsArgs: true,
|
|
274
|
+
handler: async (ctx) => {
|
|
275
|
+
// Parse: "iPhone kΔ±lΔ±f 199 TL" veya "SKU-123 %10 indirim"
|
|
276
|
+
const result = await productTool.parseAndUpdatePrice(ctx.args, { api, memory });
|
|
277
|
+
return { text: result.message };
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
api.registerCommand({
|
|
282
|
+
name: 'rapor',
|
|
283
|
+
description: 'SatΔ±Ε raporu gΓΆster',
|
|
284
|
+
acceptsArgs: true,
|
|
285
|
+
handler: async (ctx) => {
|
|
286
|
+
const period = ctx.args?.trim() || '7d';
|
|
287
|
+
const report = await analyticsTool.getSalesReport(period, { api, memory });
|
|
288
|
+
return { text: formatSalesReport(report) };
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
api.registerCommand({
|
|
293
|
+
name: 'rakip',
|
|
294
|
+
description: 'Rakip fiyatlarΔ±nΔ± kontrol et',
|
|
295
|
+
acceptsArgs: true,
|
|
296
|
+
handler: async (ctx) => {
|
|
297
|
+
const barcode = ctx.args?.trim();
|
|
298
|
+
if (!barcode) return { text: 'β Barkod veya ΓΌrΓΌn adΔ± belirtin.' };
|
|
299
|
+
const result = await repricerTool.analyzeCompetitors(barcode, { api, memory });
|
|
300
|
+
return { text: formatCompetitorReport(result) };
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
api.registerCommand({
|
|
305
|
+
name: 'lisans',
|
|
306
|
+
description: 'Lisans durumunu gΓΆster',
|
|
307
|
+
handler: async () => {
|
|
308
|
+
const status = await license.getStatus();
|
|
309
|
+
return { text: formatLicenseStatus(status) };
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
api.registerCommand({
|
|
314
|
+
name: 'uyari',
|
|
315
|
+
description: 'UyarΔ±larΔ± gΓΆster',
|
|
316
|
+
handler: async () => {
|
|
317
|
+
const alerts = alertService.alerts.filter(a => !a.read);
|
|
318
|
+
return { text: alertService.formatAlerts(alerts) };
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
api.registerCommand({
|
|
323
|
+
name: 'zamanlama',
|
|
324
|
+
description: 'ZamanlanmΔ±Ε gΓΆrevleri gΓΆster',
|
|
325
|
+
acceptsArgs: true,
|
|
326
|
+
handler: async (ctx) => {
|
|
327
|
+
if (ctx.args?.includes('ekle')) {
|
|
328
|
+
const templates = scheduler.getTemplates();
|
|
329
|
+
let msg = 'π
**HazΔ±r Εablonlar**\n\n';
|
|
330
|
+
templates.forEach(t => {
|
|
331
|
+
msg += `β’ \`${t.name}\`: ${t.scheduleHuman}\n`;
|
|
332
|
+
});
|
|
333
|
+
msg += '\n*Eklemek iΓ§in: /zamanlama ekle [Εablon]*';
|
|
334
|
+
return { text: msg };
|
|
335
|
+
}
|
|
336
|
+
const jobs = await scheduler.listJobs();
|
|
337
|
+
return { text: formatScheduleList(jobs) };
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
api.registerCommand({
|
|
342
|
+
name: 'platformlar',
|
|
343
|
+
description: 'BaΔlΔ± platformlarΔ± gΓΆster',
|
|
344
|
+
handler: async () => {
|
|
345
|
+
const result = quickReportTool.generatePlatformStatus();
|
|
346
|
+
return { text: result.report };
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
// π₯ Multi-Agent Team Command
|
|
351
|
+
api.registerCommand({
|
|
352
|
+
name: 'team',
|
|
353
|
+
description: 'Yapay Zeka TakΔ±mΔ± ile konuΕ (Milo, Josh, Marketing, Dev)',
|
|
354
|
+
acceptsArgs: true,
|
|
355
|
+
handler: async (ctx) => {
|
|
356
|
+
// Lazy load to avoid circular deps or early init issues
|
|
357
|
+
const TeamModule = (await import('../../modules/team/index.js')).default;
|
|
358
|
+
const team = new TeamModule(api);
|
|
359
|
+
await team.initialize();
|
|
360
|
+
|
|
361
|
+
const args = ctx.args ? ctx.args.trim().split(' ') : [];
|
|
362
|
+
const subCommand = args[0];
|
|
363
|
+
|
|
364
|
+
if (!subCommand) {
|
|
365
|
+
return { text: 'Komutlar: /team chat [agent] [mesaj], /team status, /team broadcast [mesaj]' };
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (subCommand === 'chat') {
|
|
369
|
+
const agentName = args[1];
|
|
370
|
+
const message = args.slice(2).join(' ');
|
|
371
|
+
if (!agentName || !message) return { text: 'KullanΔ±m: /team chat [milo|josh|marketing|dev] [mesaj]' };
|
|
372
|
+
|
|
373
|
+
const response = await team.chat(agentName, message);
|
|
374
|
+
return { text: `**@${agentName}**: ${response}` };
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if (subCommand === 'broadcast') {
|
|
378
|
+
const message = args.slice(1).join(' ');
|
|
379
|
+
if (!message) return { text: 'Mesaj yazΔ±n.' };
|
|
380
|
+
|
|
381
|
+
const results = await team.broadcast(message);
|
|
382
|
+
let report = 'π’ **TakΔ±m YanΔ±tlarΔ±**\n\n';
|
|
383
|
+
for (const [name, res] of Object.entries(results)) {
|
|
384
|
+
report += `**@${name}**: ${res}\n\n`;
|
|
385
|
+
}
|
|
386
|
+
return { text: report };
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
if (subCommand === 'status') {
|
|
390
|
+
const memory = team.getSharedMemory().getEverything();
|
|
391
|
+
return { text: `π **TakΔ±m Durumu**\n\n**Hedefler:**\n${memory.goals}\n\n**Durum:**\n${memory.status}` };
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
return { text: 'GeΓ§ersiz komut. KullanΔ±labilir: chat, broadcast, status' };
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
399
|
+
// βοΈ SERVICES - Arka plan servisleri
|
|
400
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
401
|
+
|
|
402
|
+
// Lisans DoΔrulama Servisi
|
|
403
|
+
api.registerService({
|
|
404
|
+
id: 'vantuz-license',
|
|
405
|
+
start: async () => {
|
|
406
|
+
logger.info('π Lisans servisi baΕlatΔ±lΔ±yor...');
|
|
407
|
+
await license.initialize();
|
|
408
|
+
|
|
409
|
+
// Her 24 saatte bir lisans kontrolΓΌ
|
|
410
|
+
setInterval(() => license.verify(), 24 * 60 * 60 * 1000);
|
|
411
|
+
},
|
|
412
|
+
stop: () => {
|
|
413
|
+
logger.info('π Lisans servisi durduruluyor...');
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
// Hippocampus HafΔ±za Servisi
|
|
418
|
+
api.registerService({
|
|
419
|
+
id: 'vantuz-memory',
|
|
420
|
+
start: async () => {
|
|
421
|
+
logger.info('π§ Hippocampus hafΔ±za sistemi baΕlatΔ±lΔ±yor...');
|
|
422
|
+
await memory.initialize();
|
|
423
|
+
},
|
|
424
|
+
stop: async () => {
|
|
425
|
+
logger.info('π§ Hippocampus kapatΔ±lΔ±yor...');
|
|
426
|
+
await memory.close();
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
// Repricer Daemon (Arka planda fiyat kontrolΓΌ)
|
|
431
|
+
api.registerService({
|
|
432
|
+
id: 'vantuz-repricer-daemon',
|
|
433
|
+
start: () => {
|
|
434
|
+
logger.info('π©Έ Kan Emici Repricer daemon baΕlatΔ±lΔ±yor...');
|
|
435
|
+
|
|
436
|
+
// Her 15 dakikada bir fiyat kontrolΓΌ
|
|
437
|
+
const interval = setInterval(async () => {
|
|
438
|
+
if (!license.isValid()) return;
|
|
439
|
+
|
|
440
|
+
try {
|
|
441
|
+
const decisions = await repricerTool.runAutoCycle({ api, memory, license });
|
|
442
|
+
if (decisions.length > 0) {
|
|
443
|
+
logger.info(`π° ${decisions.length} fiyat kararΔ± alΔ±ndΔ±.`);
|
|
444
|
+
}
|
|
445
|
+
} catch (err) {
|
|
446
|
+
logger.error('Repricer hatasΔ±:', err);
|
|
447
|
+
}
|
|
448
|
+
}, 15 * 60 * 1000);
|
|
449
|
+
|
|
450
|
+
// Store interval for cleanup
|
|
451
|
+
this._repricerInterval = interval;
|
|
452
|
+
},
|
|
453
|
+
stop: () => {
|
|
454
|
+
if (this._repricerInterval) {
|
|
455
|
+
clearInterval(this._repricerInterval);
|
|
456
|
+
}
|
|
457
|
+
logger.info('π©Έ Repricer daemon durduruluyor...');
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
462
|
+
// π GATEWAY RPC - Harici API metodlarΔ±
|
|
463
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
464
|
+
|
|
465
|
+
api.registerGatewayMethod('vantuz.status', ({ respond }) => {
|
|
466
|
+
respond(true, {
|
|
467
|
+
version: PLUGIN_VERSION,
|
|
468
|
+
license: license.getStatus(),
|
|
469
|
+
memory: memory.getStats(),
|
|
470
|
+
platforms: platformHub.getStatus()
|
|
471
|
+
});
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
api.registerGatewayMethod('vantuz.config', ({ respond, params }) => {
|
|
475
|
+
if (params.action === 'get') {
|
|
476
|
+
respond(true, config.get('vantuz') || {});
|
|
477
|
+
} else if (params.action === 'set') {
|
|
478
|
+
config.set('vantuz', params.data);
|
|
479
|
+
respond(true, { success: true });
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
484
|
+
// π HELPER FUNCTIONS
|
|
485
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
486
|
+
|
|
487
|
+
function formatStockReport(stocks) {
|
|
488
|
+
let report = 'π¦ **Stok Durumu**\n\n';
|
|
489
|
+
for (const [platform, data] of Object.entries(stocks)) {
|
|
490
|
+
report += `**${platform}**\n`;
|
|
491
|
+
report += `β’ Toplam: ${data.total} ΓΌrΓΌn\n`;
|
|
492
|
+
report += `β’ Kritik (<5): ${data.critical} ΓΌrΓΌn\n`;
|
|
493
|
+
report += `β’ SΔ±fΔ±r stok: ${data.zero} ΓΌrΓΌn\n\n`;
|
|
494
|
+
}
|
|
495
|
+
return report;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
function formatSalesReport(report) {
|
|
499
|
+
return `π **SatΔ±Ε Raporu (${report.period})**
|
|
500
|
+
|
|
501
|
+
π° Toplam Ciro: ${report.revenue.toLocaleString('tr-TR')} βΊ
|
|
502
|
+
π¦ Toplam SipariΕ: ${report.orders}
|
|
503
|
+
π Ortalama Sepet: ${report.avgBasket.toLocaleString('tr-TR')} βΊ
|
|
504
|
+
π En Γok Satan: ${report.topProduct}`;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
function formatCompetitorReport(result) {
|
|
508
|
+
let report = `π **Rakip Analizi: ${result.product}**\n\n`;
|
|
509
|
+
for (const comp of result.competitors) {
|
|
510
|
+
report += `β’ ${comp.name}: ${comp.price} βΊ (Stok: ${comp.stock})\n`;
|
|
511
|
+
}
|
|
512
|
+
report += `\nπ‘ **Γneri**: ${result.recommendation}`;
|
|
513
|
+
return report;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
function formatLicenseStatus(status) {
|
|
517
|
+
if (!status.valid) {
|
|
518
|
+
return `β **Lisans GeΓ§ersiz**\nNeden: ${status.reason}`;
|
|
519
|
+
}
|
|
520
|
+
return `β
**Lisans Aktif**
|
|
521
|
+
π€ MΓΌΕteri: ${status.customer}
|
|
522
|
+
π
BitiΕ: ${status.expiry}
|
|
523
|
+
β° Kalan: ${status.daysLeft} gΓΌn`;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// Plugin yΓΌklendi
|
|
527
|
+
logger.info(`π Vantuz AI v${PLUGIN_VERSION} yΓΌklendi!`);
|
|
528
|
+
}
|