@m13v/s4l 1.7.4-rc.35 → 1.7.4-rc.37

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,4 +1,4 @@
1
1
  {
2
- "version": "1.7.4-rc.35",
3
- "installedAt": "2026-07-14T00:14:09.998Z"
2
+ "version": "1.7.4-rc.37",
3
+ "installedAt": "2026-07-14T00:48:44.282Z"
4
4
  }
package/mcp/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "dxt_version": "0.1",
3
3
  "name": "social-autoposter",
4
4
  "display_name": "S4L",
5
- "version": "1.7.4-rc.35",
5
+ "version": "1.7.4-rc.37",
6
6
  "description": "Draft, review, approve, and autopilot X/Twitter posts.",
7
7
  "long_description": "## **⚠️ The disclaimer above is generic Claude boilerplate.** Anthropic shows the same warning on every plugin regardless of what it does; any plugin has the same level of access as any app you download from the internet.\n\nS4L is an open source product developed by Mediar.ai Incorporated, a VC-backed San Francisco-based startup.\n\nTo get started:\n\n1\\. Copy this prompt: **Set me up on S4L plugin end to end**\n\n2\\. Quit with CMD+Q, reopen Claude, paste into a new chat.\n\nWhat happens next:\n\n* About every 5 minutes S4L scans X for posts that match your topics and drafts replies in your voice.\n* Drafts show up as review cards, usually the first within a few minutes. Nothing is posted automatically; you approve each one.\n* Posting autopilot stays off until you explicitly turn it on.",
8
8
  "author": {
package/mcp/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m13v/s4l-mcp",
3
- "version": "1.7.4-rc.35",
3
+ "version": "1.7.4-rc.37",
4
4
  "private": true,
5
5
  "description": "Desktop MCP client for social-autoposter (X/Twitter rail): manual draft/review/approve loop, autopilot control, and stats. Thin wrapper over the existing pipeline scripts.",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m13v/s4l",
3
- "version": "1.7.4-rc.35",
3
+ "version": "1.7.4-rc.37",
4
4
  "description": "Automated social posting pipeline for Reddit, X/Twitter, LinkedIn, and Moltbook. Install as a Claude Code agent skill.",
5
5
  "bin": {
6
6
  "social-autoposter": "bin/cli.js",
@@ -55,6 +55,8 @@ import json
55
55
  import os
56
56
  import pathlib
57
57
  import re
58
+ import sys
59
+ import threading
58
60
  import time
59
61
  import urllib.parse
60
62
 
@@ -245,6 +247,40 @@ def _navigate(url: str) -> None:
245
247
  new_tab(url)
246
248
 
247
249
 
250
+ # Per-query stall guard (2026-07-13). The daemon helpers (goto_url/js) relay
251
+ # CDP through the harness daemon; against a half-wedged Chrome those calls can
252
+ # hang far past any useful budget, and one stuck query froze a Phase 1 scan at
253
+ # "scan 0 · 23m" while holding the browser lock — the entry wedge check can't
254
+ # help because the NEXT cycle can't start until this one dies. Self-heal from
255
+ # inside instead: if a single scan() call exceeds the deadline, print a loud
256
+ # marker, stamp the wedge strike file (so the next cycle's two-strike gate in
257
+ # twitter-backend.sh converges to a kill+relaunch if Chrome is still sick),
258
+ # and hard-exit the scan process so the cycle fails fast and releases the
259
+ # lock. A healthy query completes in well under a minute; 240s is generous.
260
+ _SCAN_QUERY_DEADLINE_S = float(os.environ.get("S4L_SCAN_QUERY_DEADLINE_S", "240"))
261
+ _WEDGE_STRIKE_FILE = "/tmp/s4l_cdp_wedge_strike_9555" # matches twitter-backend.sh
262
+
263
+
264
+ def _arm_stall_guard(query: str):
265
+ def _fire():
266
+ sys.stderr.write(
267
+ f"[twitter_scan] SCAN_STALL_ABORT query={query!r} "
268
+ f"deadline={_SCAN_QUERY_DEADLINE_S:.0f}s — CDP call hung (wedged "
269
+ "Chrome); stamping wedge strike and aborting the scan process\n"
270
+ )
271
+ sys.stderr.flush()
272
+ try:
273
+ pathlib.Path(_WEDGE_STRIKE_FILE).touch()
274
+ except OSError:
275
+ pass
276
+ os._exit(75) # EX_TEMPFAIL: cycle fails fast, lock + slot free up
277
+
278
+ t = threading.Timer(_SCAN_QUERY_DEADLINE_S, _fire)
279
+ t.daemon = True
280
+ t.start()
281
+ return t
282
+
283
+
248
284
  def scan(
249
285
  query: str,
250
286
  project: str,
@@ -257,6 +293,21 @@ def scan(
257
293
  ###TWEETS_BEGIN###/###TWEETS_END### sentinels for the scan model to relay
258
294
  into StructuredOutput; also returns the kept list so direct callers (tests,
259
295
  future shell-driven invocations) can consume it without parsing stdout."""
296
+ _stall_guard = _arm_stall_guard(query)
297
+ try:
298
+ return _scan_inner(query, project, search_topic, freshness_hours, skip_ids, settle_seconds)
299
+ finally:
300
+ _stall_guard.cancel()
301
+
302
+
303
+ def _scan_inner(
304
+ query: str,
305
+ project: str,
306
+ search_topic: str,
307
+ freshness_hours: int = 6,
308
+ skip_ids=None,
309
+ settle_seconds: float = 4.0,
310
+ ) -> list:
260
311
  skip = {str(s) for s in (skip_ids or [])}
261
312
  url = _build_url(query, int(freshness_hours))
262
313
  _navigate(url)
@@ -17,7 +17,15 @@ from pathlib import Path
17
17
 
18
18
  REPO = Path("/Users/matthewdi/social-autoposter")
19
19
  LOG_RUN_PY = REPO / "scripts" / "log_run.py"
20
- SKILL_PATH_MARKER = "/social-autoposter/skill/"
20
+ # Both homes of skill/*.sh: the operator repo AND the installed-app package.
21
+ # The single operator-repo marker left every kicker-driven cycle (which runs
22
+ # from ~/.social-autoposter-mcp/repo/package/skill/) invisible to this
23
+ # watchdog — a scan stuck on a half-wedged Chrome sat 23+ minutes at zero
24
+ # progress with nothing entitled to kill it (2026-07-13).
25
+ SKILL_PATH_MARKERS = (
26
+ "/social-autoposter/skill/",
27
+ "/.social-autoposter-mcp/repo/package/skill/",
28
+ )
21
29
  MAX_AGE_SEC = 45 * 60
22
30
 
23
31
  # --- L2: browser-lock liveness (2026-07-13) ----------------------------------
@@ -212,12 +220,12 @@ def list_skill_shell_processes():
212
220
  ppid = int(ppid_s)
213
221
  except ValueError:
214
222
  continue
215
- if SKILL_PATH_MARKER not in command:
223
+ if not any(m in command for m in SKILL_PATH_MARKERS):
216
224
  continue
217
225
  script_name = None
218
226
  tokens = command.split()
219
227
  for tok in tokens:
220
- if tok.endswith(".sh") and SKILL_PATH_MARKER in tok:
228
+ if tok.endswith(".sh") and any(m in tok for m in SKILL_PATH_MARKERS):
221
229
  script_name = os.path.basename(tok)
222
230
  break
223
231
  if not script_name:
@@ -333,6 +333,19 @@ ensure_linkedin_browser_for_backend() {
333
333
  # The occlusion/backgrounding flags matter: the window sits offscreen,
334
334
  # and without them Chrome stops laying out SPA-rendered content, so
335
335
  # every element measures 0x0 and clicks become impossible (2026-07-03).
336
+ # Mark the profile's last exit as clean BEFORE launching, so a
337
+ # SIGKILLed Chrome doesn't session-restore a crashed "Aw, Snap" tab on
338
+ # relaunch (same fix + rationale as twitter-backend.sh, 2026-07-13).
339
+ "${S4L_PYTHON:-python3}" -c 'import json, os, sys
340
+ p = os.path.join(sys.argv[1], "Default", "Preferences")
341
+ try:
342
+ d = json.load(open(p))
343
+ except Exception:
344
+ raise SystemExit(0)
345
+ prof = d.setdefault("profile", {})
346
+ prof["exit_type"] = "Normal"
347
+ prof["exited_cleanly"] = True
348
+ json.dump(d, open(p, "w"))' "$_prof_dir" 2>/dev/null || true
336
349
  # Launch flags shared by both spawn paths below.
337
350
  local _li_launch_args=(
338
351
  --remote-debugging-port=9556
@@ -334,6 +334,23 @@ ensure_twitter_browser_for_backend() {
334
334
  [ -n "$_stale_pids" ] && { kill -9 $_stale_pids 2>/dev/null || true; sleep 1; }
335
335
  rm -f "$_prof_dir/SingletonLock" "$_prof_dir/SingletonSocket" "$_prof_dir/SingletonCookie" 2>/dev/null || true
336
336
  fi
337
+ # Mark the profile's last exit as clean BEFORE launching. A SIGKILLed
338
+ # Chrome (wedge heal, stall abort) records exit_type=Crashed, and the
339
+ # next launch then session-restores the dead session's tab, which
340
+ # renders as a lingering "Aw, Snap" corpse the user keeps seeing
341
+ # (2026-07-13, twice). With the profile marked clean, Chrome opens
342
+ # ONLY our startup URL. Best-effort: a missing/corrupt Preferences
343
+ # file just skips.
344
+ "${S4L_PYTHON:-python3}" -c 'import json, os, sys
345
+ p = os.path.join(sys.argv[1], "Default", "Preferences")
346
+ try:
347
+ d = json.load(open(p))
348
+ except Exception:
349
+ raise SystemExit(0)
350
+ prof = d.setdefault("profile", {})
351
+ prof["exit_type"] = "Normal"
352
+ prof["exited_cleanly"] = True
353
+ json.dump(d, open(p, "w"))' "$_prof_dir" 2>/dev/null || true
337
354
  # Launch flags shared by both spawn paths below.
338
355
  local _launch_args=(
339
356
  --remote-debugging-port=9555