social-agent-cli 2.3.0 → 2.3.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.
Files changed (2) hide show
  1. package/ai/runner.ts +17 -11
  2. package/package.json +1 -1
package/ai/runner.ts CHANGED
@@ -175,23 +175,29 @@ async function executeStep(page: any, step: any, post: Post, params: Record<stri
175
175
  const filePath = rp(step.value || "{{IMAGE}}");
176
176
  if (!filePath || filePath.includes("{{")) break;
177
177
 
178
- // 1. fileChooser ile butona tıkla
179
- for (const sel of selectors) {
180
- try {
181
- const fcp = page.waitForEvent("filechooser", { timeout: 5000 });
182
- await page.click(sel).catch(() => {});
183
- const fc = await fcp;
184
- await fc.setFiles(filePath);
185
- return;
186
- } catch {}
187
- }
188
- // 2. input[type=file] direkt
178
+ // 1. input[type=file] direkt (file picker açmaz)
189
179
  try {
190
180
  const inputs = await page.locator('input[type="file"]').all();
191
181
  for (const input of inputs) {
192
182
  try { await input.setInputFiles(filePath); return; } catch {}
193
183
  }
194
184
  } catch {}
185
+
186
+ // 2. fileChooser ile butona tıkla
187
+ for (const sel of selectors) {
188
+ 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 {}
200
+ }
195
201
  throw new Error(`Upload: ${filePath}`);
196
202
  }
197
203
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "social-agent-cli",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "AI-powered social media agent - free APIs + browser automation with self-healing selectors",
5
5
  "type": "module",
6
6
  "bin": {