social-agent-cli 4.2.0 → 4.2.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.
@@ -1,7 +1,5 @@
1
1
  /**
2
- * Upload helper - CDP fileChooser intercept ile dosya yükler
3
- * LinkedIn gibi native file dialog kullanan platformlar için
4
- *
2
+ * Upload helper - Playwright fileChooser ile dosya yükler
5
3
  * Kullanım: npx tsx core/upload-helper.ts <cdp-port> <click-selector> <file-path>
6
4
  */
7
5
  import { chromium } from "playwright";
@@ -9,49 +7,28 @@ import { chromium } from "playwright";
9
7
  const [, , port, selector, filePath] = process.argv;
10
8
 
11
9
  if (!port || !selector || !filePath) {
12
- console.error("Kullanım: npx tsx core/upload-helper.ts <port> <selector> <file-path>");
13
10
  process.exit(1);
14
11
  }
15
12
 
16
13
  async function upload() {
17
14
  const browser = await chromium.connectOverCDP(`http://127.0.0.1:${port}`);
18
15
  const pages = browser.contexts()[0].pages();
19
- const page = pages[pages.length - 1];
16
+ // LinkedIn sayfasını bul
17
+ const page = pages.find(p => p.url().includes("linkedin.com")) || pages[0];
20
18
 
21
- // fileChooser event'ini dinlemeye başla
22
- let resolved = false;
19
+ // fileChooser promise'ı ÖNCE başlat
23
20
  const fcPromise = page.waitForEvent("filechooser", { timeout: 10000 });
24
21
 
25
- // Butona tıkla - fileChooser tetiklenecek
26
- // Birden fazla selector dene
27
- const selectors = selector.split("|");
28
- for (const sel of selectors) {
29
- try {
30
- // Playwright text selector
31
- if (sel.startsWith("text=")) {
32
- await page.click(sel);
33
- } else {
34
- // CSS selector veya role selector
35
- const el = page.locator(sel).first();
36
- if (await el.isVisible({ timeout: 2000 })) {
37
- await el.click();
38
- }
39
- }
40
- } catch {}
41
- }
42
-
43
- try {
44
- const fc = await fcPromise;
45
- await fc.setFiles(filePath);
46
- resolved = true;
47
- console.log("OK");
48
- } catch (e: any) {
49
- console.error("FAIL:", e.message.substring(0, 100));
50
- process.exit(1);
51
- }
22
+ // Butona tıkla
23
+ try { await page.click(selector, { timeout: 5000 }); } catch {}
24
+
25
+ // fileChooser'ı yakala ve dosya set et
26
+ const fc = await fcPromise;
27
+ await fc.setFiles(filePath);
28
+ console.log("OK");
29
+
30
+ // Hemen çık - beklemeden
31
+ process.exit(0);
52
32
  }
53
33
 
54
- upload().catch((e) => {
55
- console.error(e.message);
56
- process.exit(1);
57
- });
34
+ upload().catch(() => process.exit(1));
@@ -5,7 +5,8 @@
5
5
  "description": "LinkedIn post paylaşma",
6
6
  "version": 3,
7
7
  "parameters": [
8
- "{{CONTENT}}"
8
+ "{{CONTENT}}",
9
+ "{{IMAGE}}"
9
10
  ],
10
11
  "steps": [
11
12
  {
package/maps/x.json CHANGED
@@ -6,7 +6,8 @@
6
6
  "version": 1,
7
7
  "lastUpdated": "2026-03-14T12:00:00.000Z",
8
8
  "parameters": [
9
- "{{CONTENT}}"
9
+ "{{CONTENT}}",
10
+ "{{IMAGE}}"
10
11
  ],
11
12
  "steps": [
12
13
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "social-agent-cli",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "description": "AI-powered social media agent - free APIs + browser automation with self-healing selectors",
5
5
  "type": "module",
6
6
  "bin": {