social-agent-cli 4.2.2 → 4.3.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/ai/runner.ts CHANGED
@@ -5,7 +5,7 @@ import type { Post } from "../core/types.js";
5
5
 
6
6
  const BROWSER_PLATFORMS: Record<string, string> = {
7
7
  x: "https://x.com",
8
- linkedin: "https://www.linkedin.com",
8
+ linkedin: "https://www.linkedin.com/feed/",
9
9
  };
10
10
 
11
11
  /**
package/cli.ts CHANGED
@@ -8,7 +8,7 @@ import type { Post, PostResult, PlatformDriver } from "./core/types.js";
8
8
  // ── Platform registry ────────────────────────────────────────
9
9
  const BROWSER_PLATFORMS: Record<string, string> = {
10
10
  x: "https://x.com",
11
- linkedin: "https://www.linkedin.com",
11
+ linkedin: "https://www.linkedin.com/feed/",
12
12
  };
13
13
 
14
14
  function getAllDrivers(): PlatformDriver[] {
@@ -1,33 +1,37 @@
1
1
  /**
2
- * Upload helper - Playwright fileChooser ile dosya yükler
2
+ * Upload helper - Playwright fileChooser ile dosya yükler + editör modal'ı kapatır
3
3
  * Kullanım: npx tsx core/upload-helper.ts <cdp-port> <click-selector> <file-path>
4
4
  */
5
5
  import { chromium } from "playwright";
6
6
 
7
7
  const [, , port, selector, filePath] = process.argv;
8
-
9
- if (!port || !selector || !filePath) {
10
- process.exit(1);
11
- }
8
+ if (!port || !selector || !filePath) process.exit(1);
12
9
 
13
10
  async function upload() {
14
11
  const browser = await chromium.connectOverCDP(`http://127.0.0.1:${port}`);
15
12
  const pages = browser.contexts()[0].pages();
16
- // LinkedIn sayfasını bul
17
- const page = pages.find(p => p.url().includes("linkedin.com")) || pages[0];
13
+ const page = pages.find(p => p.url().includes("linkedin.com") || p.url().includes("x.com")) || pages[0];
18
14
 
19
- // fileChooser promise'ı ÖNCE başlat
15
+ // 1. fileChooser yakala + butona tıkla
20
16
  const fcPromise = page.waitForEvent("filechooser", { timeout: 10000 });
21
-
22
- // Butona tıkla
23
17
  try { await page.click(selector, { timeout: 5000 }); } catch {}
24
-
25
- // fileChooser'ı yakala ve dosya set et
26
18
  const fc = await fcPromise;
27
19
  await fc.setFiles(filePath);
28
- console.log("OK");
29
20
 
30
- // Hemen çık - beklemeden
21
+ // 2. Editör modal'ı çıkarsa "İleri/Bitti/Done/Next" butonuna tıkla
22
+ await page.waitForTimeout(3000);
23
+ for (const text of ["İleri", "Bitti", "Done", "Next", "Tamam"]) {
24
+ try {
25
+ const btn = page.getByRole("button", { name: text });
26
+ if (await btn.isVisible({ timeout: 1000 })) {
27
+ await btn.click();
28
+ await page.waitForTimeout(1500);
29
+ break;
30
+ }
31
+ } catch {}
32
+ }
33
+
34
+ console.log("OK");
31
35
  process.exit(0);
32
36
  }
33
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "social-agent-cli",
3
- "version": "4.2.2",
3
+ "version": "4.3.0",
4
4
  "description": "AI-powered social media agent - free APIs + browser automation with self-healing selectors",
5
5
  "type": "module",
6
6
  "bin": {
@@ -159,7 +159,8 @@ export class BrowserDriver {
159
159
 
160
160
  for (const text of texts) {
161
161
  try {
162
- this.cmd(`eval "document.querySelectorAll('button,a,[role=button]').forEach(b => { if(b.textContent.trim()==='${text}' || b.textContent.trim().startsWith('${text}')) b.click() })"`);
162
+ // Sadece BUTTON elementlerinde tam eşleşme ara - link'lere tıklama
163
+ this.cmd(`eval "document.querySelectorAll('button').forEach(b => { if(b.textContent.trim()==='${text}') b.click() })"`);
163
164
  if (step.waitMs) this.cmd(`wait ${step.waitMs}`);
164
165
  return;
165
166
  } catch {}
@@ -221,13 +222,6 @@ export class BrowserDriver {
221
222
  { encoding: "utf-8", timeout: 60000 }
222
223
  ).trim();
223
224
  if (helperResult === "OK") {
224
- // Editör modal kapatma - "İleri" butonuna tıkla (3 saniye bekle, modal yüklensin)
225
- setTimeout(() => {}, 3000);
226
- try {
227
- execSync(`agent-browser --cdp ${CDP_PORT} wait 3000`, { stdio: "pipe", timeout: 10000 });
228
- execSync(`agent-browser --cdp ${CDP_PORT} eval "document.querySelectorAll('button').forEach(b => { var t=b.textContent.trim().toLowerCase(); if(t==='ileri' || t==='bitti' || t==='done' || t==='next') b.click() })"`, { stdio: "pipe", timeout: 5000 });
229
- execSync(`agent-browser --cdp ${CDP_PORT} wait 2000`, { stdio: "pipe", timeout: 5000 });
230
- } catch {}
231
225
  return;
232
226
  }
233
227
  } catch (e: any) {