social-agent-cli 2.3.1 → 2.3.2

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 +14 -14
  2. package/package.json +1 -1
package/ai/runner.ts CHANGED
@@ -178,25 +178,25 @@ async function executeStep(page: any, step: any, post: Post, params: Record<stri
178
178
  // 1. input[type=file] direkt (file picker açmaz)
179
179
  try {
180
180
  const inputs = await page.locator('input[type="file"]').all();
181
- for (const input of inputs) {
182
- try { await input.setInputFiles(filePath); return; } catch {}
181
+ for (const inp of inputs) {
182
+ try { await inp.setInputFiles(filePath); return; } catch {}
183
183
  }
184
184
  } catch {}
185
185
 
186
- // 2. fileChooser ile butona tıkla
186
+ // 2. fileChooser event listener ile butona tıkla
187
187
  for (const sel of selectors) {
188
+ let done = false;
189
+ const handler = async (fc: any) => { await fc.setFiles(filePath); done = true; };
190
+ page.on("filechooser", handler);
188
191
  try {
189
- const fc = await Promise.race([
190
- (async () => {
191
- const fcp = page.waitForEvent("filechooser", { timeout: 4000 });
192
- await page.click(sel);
193
- return await fcp;
194
- })(),
195
- new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), 5000)),
196
- ]) as any;
197
- await fc.setFiles(filePath);
198
- return;
199
- } catch {}
192
+ await page.click(sel);
193
+ // fileChooser event'inin tetiklenmesini bekle
194
+ for (let w = 0; w < 20 && !done; w++) await page.waitForTimeout(250);
195
+ page.removeListener("filechooser", handler);
196
+ if (done) return;
197
+ } catch {
198
+ page.removeListener("filechooser", handler);
199
+ }
200
200
  }
201
201
  throw new Error(`Upload: ${filePath}`);
202
202
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "social-agent-cli",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "AI-powered social media agent - free APIs + browser automation with self-healing selectors",
5
5
  "type": "module",
6
6
  "bin": {