social-autoposter 1.6.28 → 1.6.29
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/bin/cli.js
CHANGED
|
@@ -549,23 +549,28 @@ function installBrowserHarness() {
|
|
|
549
549
|
spawnSync(harnessBin, ['--reload'], { stdio: 'inherit' });
|
|
550
550
|
}
|
|
551
551
|
|
|
552
|
-
// Contract check: server.py
|
|
553
|
-
//
|
|
554
|
-
//
|
|
555
|
-
//
|
|
556
|
-
//
|
|
557
|
-
//
|
|
552
|
+
// Contract check: server.py pipes the script to browser-harness via stdin.
|
|
553
|
+
// Upstream supports two banner shapes — older builds advertise `-c <script>`
|
|
554
|
+
// and newer builds advertise the `<<'PY' ... PY` heredoc form. Either is
|
|
555
|
+
// fine for our use case (we pass the script via stdin, which both accept).
|
|
556
|
+
// Fail loudly if the installed binary advertises NEITHER, which usually
|
|
557
|
+
// means an offline/partial clone left a broken CLI that will silently make
|
|
558
|
+
// every bh_run look like "CDP not connected".
|
|
558
559
|
if (fs.existsSync(harnessBin)) {
|
|
559
560
|
const probe = spawnSync(harnessBin, [], { stdio: 'pipe', encoding: 'utf8', timeout: 15000 });
|
|
560
561
|
const usage = `${probe.stdout || ''}${probe.stderr || ''}`;
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
562
|
+
const supportsDashC = /\b-c\b/.test(usage);
|
|
563
|
+
const supportsStdin = /<<'PY'|<<"PY"|<<PY\b/.test(usage);
|
|
564
|
+
if (!supportsDashC && !supportsStdin) {
|
|
565
|
+
console.error(' ERROR: installed browser-harness CLI advertises neither `-c` nor a stdin heredoc.');
|
|
566
|
+
console.error(' This usually means a partial/corrupted install. The twitter-harness MCP will');
|
|
567
|
+
console.error(' return a usage banner / "CDP not connected" on every call.');
|
|
564
568
|
console.error(` Fix: rm -rf ${harnessDir} && re-run \`social-autoposter init\` while online,`);
|
|
565
569
|
console.error(' or manually: git clone https://github.com/browser-use/browser-harness ' + harnessDir +
|
|
566
570
|
' && ' + uvBin + ' tool install --force -e ' + harnessDir);
|
|
567
571
|
} else {
|
|
568
|
-
|
|
572
|
+
const shape = supportsStdin ? 'stdin heredoc' : '-c flag';
|
|
573
|
+
console.log(` browser-harness CLI verified (${shape}).`);
|
|
569
574
|
}
|
|
570
575
|
}
|
|
571
576
|
}
|
|
Binary file
|
|
@@ -407,9 +407,14 @@ def _run_harness(script: str, timeout: int = EXEC_TIMEOUT_SEC) -> dict:
|
|
|
407
407
|
# Make sure ~/.local/bin is on PATH (uv tools live there).
|
|
408
408
|
env["PATH"] = f"{Path.home()}/.local/bin:" + env.get("PATH", "")
|
|
409
409
|
|
|
410
|
+
# Upstream browser-harness dropped the `-c <script>` flag and now reads the
|
|
411
|
+
# script from stdin only (heredoc style). Pass via stdin so we work against
|
|
412
|
+
# current upstream; the old `-c` form returns the usage banner and exits 1,
|
|
413
|
+
# which used to surface as "CDP not connected" on every fresh install.
|
|
410
414
|
try:
|
|
411
415
|
proc = subprocess.run(
|
|
412
|
-
[BROWSER_HARNESS_BIN
|
|
416
|
+
[BROWSER_HARNESS_BIN],
|
|
417
|
+
input=script,
|
|
413
418
|
env=env,
|
|
414
419
|
capture_output=True,
|
|
415
420
|
text=True,
|
package/package.json
CHANGED