social-agent-cli 2.2.1 → 2.2.3

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 (2) hide show
  1. package/ai/runner.ts +19 -20
  2. package/package.json +1 -1
package/ai/runner.ts CHANGED
@@ -345,34 +345,33 @@ async function executeMapStep(
345
345
 
346
346
  let uploaded = false;
347
347
 
348
- // 1. Sayfadaki TÜM input[type=file]'ları bul ve dosyayı set et
349
- // Butona tıklamadan - file picker açılmasını önler
350
- try {
351
- const inputs = await page.locator('input[type="file"]').all();
352
- for (const input of inputs) {
353
- try {
354
- await input.setInputFiles(filePath);
355
- uploaded = true;
356
- break;
357
- } catch {}
358
- }
359
- } catch {}
360
-
361
- // 2. input yoksa, fileChooser event ile butona tıkla
362
- if (!uploaded && selectors.length > 0) {
348
+ // fileChooser event'ini ÖNCE kaydet, SONRA butona tıkla
349
+ // Bu sıralama kritik - yoksa OS file picker açılır
350
+ if (selectors.length > 0) {
363
351
  for (const sel of selectors) {
364
352
  try {
365
- const [fileChooser] = await Promise.all([
366
- page.waitForEvent("filechooser", { timeout: 3000 }),
367
- page.click(sel),
368
- ]);
353
+ const fileChooserPromise = page.waitForEvent("filechooser", { timeout: 5000 });
354
+ await page.click(sel).catch(() => {});
355
+ const fileChooser = await fileChooserPromise;
369
356
  await fileChooser.setFiles(filePath);
370
357
  uploaded = true;
371
358
  break;
372
- } catch {}
359
+ } catch {
360
+ // fileChooser timeout veya click hatası - sonraki selector'ı dene
361
+ }
373
362
  }
374
363
  }
375
364
 
365
+ // Fallback: sayfadaki input[type=file]'a direkt set et
366
+ if (!uploaded) {
367
+ try {
368
+ const inputs = await page.locator('input[type="file"]').all();
369
+ for (const input of inputs) {
370
+ try { await input.setInputFiles(filePath); uploaded = true; break; } catch {}
371
+ }
372
+ } catch {}
373
+ }
374
+
376
375
  if (!uploaded) throw new Error(`Upload failed: ${filePath}`);
377
376
  if (step.waitMs) await page.waitForTimeout(step.waitMs);
378
377
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "social-agent-cli",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "AI-powered social media agent - free APIs + browser automation with self-healing selectors",
5
5
  "type": "module",
6
6
  "bin": {