social-agent-cli 3.1.0 → 3.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "social-agent-cli",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "AI-powered social media agent - free APIs + browser automation with self-healing selectors",
5
5
  "type": "module",
6
6
  "bin": {
@@ -44,7 +44,7 @@ export class BrowserDriver {
44
44
 
45
45
  // CDP'ye bağlanmayı dene
46
46
  try {
47
- execSync(`agent-browser --cdp ${CDP_PORT} url`, { stdio: "pipe", timeout: 2000 });
47
+ execSync(`curl -sf http://127.0.0.1:${CDP_PORT}/json/version`, { stdio: "pipe", timeout: 2000 });
48
48
  return; // zaten çalışıyor
49
49
  } catch {}
50
50
 
@@ -73,14 +73,15 @@ export class BrowserDriver {
73
73
  this.chromeStarted = true;
74
74
 
75
75
  // Bağlantıyı bekle
76
- for (let i = 0; i < 20; i++) {
77
- await new Promise(r => setTimeout(r, 500));
76
+ for (let i = 0; i < 30; i++) {
77
+ await new Promise(r => setTimeout(r, 1000));
78
78
  try {
79
- execSync(`agent-browser --cdp ${CDP_PORT} url`, { stdio: "pipe", timeout: 2000 });
79
+ execSync(`curl -sf http://127.0.0.1:${CDP_PORT}/json/version`, { stdio: "pipe", timeout: 3000 });
80
+ console.log(`[${this.platform}] Chrome bağlandı`);
80
81
  return;
81
82
  } catch {}
82
83
  }
83
- throw new Error("Chrome başlatılamadı");
84
+ throw new Error("Chrome başlatılamadı - Chrome'u kapat ve tekrar dene");
84
85
  }
85
86
 
86
87
  async close(): Promise<void> {}
@@ -155,11 +156,11 @@ export class BrowserDriver {
155
156
 
156
157
  case "type": {
157
158
  const sels = [step.selector, ...(step.fallbackSelectors || [])].filter(Boolean);
159
+ const escaped = val.replace(/"/g, '\\"');
158
160
  for (const sel of sels) {
159
161
  if (sel.includes("{{")) continue;
160
162
  try {
161
- this.cmd(`click "${sel}"`);
162
- this.cmd(`keyboard inserttext "${val.replace(/"/g, '\\"')}"`);
163
+ this.cmd(`type "${sel}" "${escaped}"`, 30000);
163
164
  if (step.waitMs) this.cmd(`wait ${step.waitMs}`);
164
165
  return;
165
166
  } catch {}
@@ -175,9 +176,16 @@ export class BrowserDriver {
175
176
  case "upload": {
176
177
  const filePath = val || imagePath || "";
177
178
  if (!filePath || filePath.includes("{{")) break;
179
+ // Her zaman input[type=file] ile yükle - en güvenilir yol
180
+ try {
181
+ this.cmd(`upload "input[type='file']" "${filePath}"`, 10000);
182
+ if (step.waitMs) this.cmd(`wait ${step.waitMs}`);
183
+ return;
184
+ } catch {}
185
+ // Fallback: selector'larla dene
178
186
  const sels = [step.selector, ...(step.fallbackSelectors || [])].filter(Boolean);
179
187
  for (const sel of sels) {
180
- try { this.cmd(`upload "${sel}" "${filePath}"`); if (step.waitMs) this.cmd(`wait ${step.waitMs}`); return; } catch {}
188
+ try { this.cmd(`upload "${sel}" "${filePath}"`, 10000); if (step.waitMs) this.cmd(`wait ${step.waitMs}`); return; } catch {}
181
189
  }
182
190
  throw new Error(`Upload: ${filePath}`);
183
191
  }