Skip to content

code-yeongyu/oh-my-openagent / packages/shared-skills/skills/ultimate-browsing

ultimate-browsing

Flagged

Reaches web pages the user's browser cannot open: WAF-blocked and bot-scored hosts, platform-native readers (Chinese and social platforms), archive snapshots with provenance, and a browser you own for stealth or throwaway profiles. Not for plain search, an unblocked static fetch, or a page the user's browser can open.

FileKindSize
.gitignoreother29 B
ATTRIBUTION.mdmarkdown2.5 KB
SKILL.mdskill md11.9 KB
engine/AGENTS.mdmarkdown10.8 KB
engine/__init__.pyscript668 B
engine/__main__.pyscript5.0 KB
engine/bias_check.pyscript7.1 KB
engine/curl_probe.pyscript2.4 KB
engine/executor.pyscript8.0 KB
engine/fetch_chain.pyscript13.0 KB
engine/referers.pyscript327 B
engine/result_schema.pyscript1.5 KB
engine/summary.pyscript1.2 KB
engine/surrogate.pyscript7.9 KB
engine/surrogates.yamlconfig2.3 KB
engine/templates/knip.workspace.jsoncother1.5 KB
engine/templates/package.jsonmanifest349 B
engine/templates/playwright_mobile_chrome.jsscript3.6 KB
engine/templates/playwright_real_chrome.jsscript5.5 KB
engine/tests/fixtures/amp_redirect_stub.htmlother323 B
engine/tests/fixtures/search_interstitial.htmlother90.4 KB
engine/tests/fixtures/wayback_available.jsonconfig246 B
engine/tests/fixtures/wayback_snapshot.htmlother181.4 KB
engine/tests/test_executor_timeout.pyscript6.2 KB
engine/tests/test_fetch_chain.pyscript2.7 KB
engine/tests/test_playwright_stealth.pyscript3.9 KB
engine/tests/test_playwright_templates.pyscript10.7 KB
engine/tests/test_surrogate.pyscript11.3 KB
engine/tests/test_surrogate_validators.pyscript3.5 KB
engine/url_transforms.pyscript3.2 KB
engine/validators.pyscript9.1 KB
engine/waf_detector.pyscript6.9 KB
engine/waf_profiles.yamlconfig6.2 KB
references/agent-reach/README.mdmarkdown2.2 KB
references/agent-reach/career.mdmarkdown755 B
references/agent-reach/dev.mdmarkdown1.3 KB
references/agent-reach/search.mdmarkdown821 B
references/agent-reach/social.mdmarkdown5.6 KB
references/agent-reach/video.mdmarkdown2.7 KB
references/agent-reach/web.mdmarkdown2.1 KB
references/chrome-stealth.mdmarkdown2.4 KB
references/insane-search/README.mdmarkdown20.2 KB
references/insane-search/cache-archive.mdmarkdown4.1 KB
references/insane-search/fallback.mdmarkdown6.9 KB
references/insane-search/jina.mdmarkdown4.3 KB
references/insane-search/json-api.mdmarkdown3.5 KB
references/insane-search/media.mdmarkdown3.5 KB
references/insane-search/metadata.mdmarkdown2.9 KB
references/insane-search/naver.mdmarkdown3.4 KB
references/insane-search/playwright.mdmarkdown6.8 KB
references/insane-search/public-api.mdmarkdown3.4 KB
references/insane-search/rss.mdmarkdown3.0 KB
references/insane-search/tls-impersonate.mdmarkdown6.5 KB
references/insane-search/twitter.mdmarkdown3.5 KB
scripts/cookie_crypto.pyscript2.9 KB
scripts/cookie_domains.pyscript1.1 KB
scripts/cookie_paths.pyscript3.8 KB
scripts/extract_cookies.pyscript9.4 KB
scripts/tests/test_cookie_domain_filter.pyscript3.5 KB
scripts/tests/test_extract_cookies.pyscript9.4 KB

engine/tests/test_executor_timeout.py

View on GitHub
"""A timed-out template must give its browser a graceful quit before any SIGKILL.

Chrome removes its per-launch state (the macOS code-sign clone, a temp profile)
only on a clean exit, so killing the node template alone, or killing anything
without a SIGTERM grace window first, leaks it (omo#12067). A fake template and a
fake "browser" grandchild stand in for Playwright and Chrome.
"""
from __future__ import annotations

import os
import shutil
import subprocess
import sys
import tempfile
import textwrap
import time
import unittest
from pathlib import Path
from unittest import mock

sys.path.insert(0, str(Path(__file__).resolve().parents[2]))

from engine import executor  # noqa: E402

FAKE_TEMPLATE = textwrap.dedent(
    """
    const { spawn } = require('node:child_process');
    const fs = require('node:fs');
    const log = process.env.EXECUTOR_TEST_LOG;
    const record = (line) => fs.appendFileSync(log, `${line} ${Date.now()}\\n`);
    const browser = spawn(process.execPath, ['-e', `
      const fs = require('node:fs');
      process.on('SIGTERM', () => { fs.appendFileSync(${JSON.stringify(log)}, 'BROWSER_TERM ' + Date.now() + '\\\\n'); process.exit(0); });
      fs.appendFileSync(${JSON.stringify(log)}, 'BROWSER_READY ' + Date.now() + '\\\\n');
      setInterval(() => {}, 60000);
    `], { stdio: 'ignore' });
    record(`PIDS ${process.pid}:${browser.pid}`);
    process.on('SIGTERM', () => {
      record('TEMPLATE_TERM');
      if (process.env.EXECUTOR_TEST_TEMPLATE_ON_TERM === 'exit') process.exit(0);
    });
    setInterval(() => {}, 60000);
    """
)


def _alive(pid: int) -> bool:
    try:
        os.kill(pid, 0)
    except ProcessLookupError:
        return False
    return True


@unittest.skipIf(os.name == "nt" or shutil.which("node") is None, "POSIX process groups and node required")
class TimedOutTemplateTermination(unittest.TestCase):
    def _run(self, on_term: str, communicate=None) -> tuple[int, str, dict[str, list[int]], float]:
        tmp = Path(tempfile.mkdtemp(prefix="ultimate-browsing-executor-test-"))
        self.addCleanup(shutil.rmtree, tmp, True)
        (tmp / "fake_template.js").write_text(FAKE_TEMPLATE, encoding="utf-8")
        log = tmp / "events.log"
        env = {"EXECUTOR_TEST_LOG": str(log), "EXECUTOR_TEST_TEMPLATE_ON_TERM": on_term}
        try:
            with mock.patch.object(executor, "TEMPLATES_DIR", str(tmp)), mock.patch.dict(os.environ, env):
                if communicate is None:
                    code, _out, err = executor._run_node_template("fake_template.js", {}, timeout=1)
                else:
                    with mock.patch.object(executor.subprocess.Popen, "communicate", communicate(log)):
                        code, _out, err = executor._run_node_template("fake_template.js", {}, timeout=30)
        finally:
            events = self._read_events(log)
        returned_at = time.time() * 1000
        return code, err, events, returned_at

    def _read_events(self, log: Path) -> dict[str, list[int]]:
        events: dict[str, list[int]] = {}
        if not log.exists():
            return events
        for line in log.read_text(encoding="utf-8").splitlines():
            name, *rest = line.split(" ")
            events.setdefault(name, []).append(int(rest[-1]))
            if name == "PIDS":
                template_pid, browser_pid = rest[0].split(":")
                events["template_pid"] = [int(template_pid)]
                events["browser_pid"] = [int(browser_pid)]
                for pid in (int(template_pid), int(browser_pid)):
                    self.addCleanup(lambda p=pid: _alive(p) and os.kill(p, 9))
        self.last_events = events
        return events

    def _assert_gone(self, pid: int) -> None:
        deadline = time.time() + 2
        while _alive(pid) and time.time() < deadline:
            time.sleep(0.05)
        self.assertFalse(_alive(pid), f"pid {pid} outlived the timed-out template")

    def test_timeout_terms_the_whole_group_and_waits_before_kill(self) -> None:
        code, err, events, returned_at = self._run(on_term="ignore")
        self.assertEqual(code, 124, err)
        self.assertIn("BROWSER_TERM", events, "the browser grandchild never got SIGTERM")
        self.assertIn("TEMPLATE_TERM", events, "the template never got SIGTERM")
        grace_ms = returned_at - events["TEMPLATE_TERM"][0]
        self.assertGreaterEqual(grace_ms, executor.TERM_GRACE_S * 1000 - 500, "SIGKILL came without a grace window")
        self._assert_gone(events["template_pid"][0])
        self._assert_gone(events["browser_pid"][0])

    def test_template_that_quits_on_term_is_not_held_for_the_grace(self) -> None:
        code, err, events, returned_at = self._run(on_term="exit")
        self.assertEqual(code, 124, err)
        self.assertIn("TEMPLATE_TERM", events)
        self.assertLess(returned_at - events["TEMPLATE_TERM"][0], 3000)
        self._assert_gone(events["browser_pid"][0])

    def test_cancelled_run_tears_the_group_down_and_reraises(self) -> None:
        # A KeyboardInterrupt (or any BaseException) during communicate() must still
        # quit node and its browser: start_new_session means a terminal Ctrl-C no
        # longer reaches the template's group, so nobody else will.
        original = subprocess.Popen.communicate

        def interrupting(log: Path):
            calls = {"n": 0}

            def communicate(proc, *args, **kwargs):
                calls["n"] += 1
                if calls["n"] > 1:
                    return original(proc, *args, **kwargs)
                deadline = time.time() + 10
                while time.time() < deadline and not (log.exists() and "BROWSER_READY" in log.read_text(encoding="utf-8")):
                    time.sleep(0.02)
                raise KeyboardInterrupt

            return communicate

        with self.assertRaises(KeyboardInterrupt):
            self._run(on_term="exit", communicate=interrupting)
        events = self.last_events
        self.assertIn("browser_pid", events, "the fake template never started")
        self.assertIn("BROWSER_TERM", events, "the browser never got SIGTERM after the run was cancelled")
        self._assert_gone(events["template_pid"][0])
        self._assert_gone(events["browser_pid"][0])


if __name__ == "__main__":
    unittest.main()
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 197kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall