Finds open conference CFPs relevant to the user across Java/AI/developer conferences, with persistent sent/dismissed/remind state and source-aware Sessionize verification. NanoClaw per-chat overlay, loaded via containerConfig.additionalTiles.
90%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Medium
Suggest reviewing before use
"""Read public website descriptions without executing a page.
Importable helper for relevance-gate.py. The caller runs ``--fetch-meta`` in
a child with a 15-second wall deadline. Each hop pins a public DNS result,
allows at most three redirects, and reads at most 256 KiB. Bounded description and
visible topic text reach the classifier. An unavailable page supplies no description.
"""
from __future__ import annotations
import http.client
import ipaddress
import socket
import ssl
import urllib.parse
from html.parser import HTMLParser
MAX_BYTES = 262_144
MAX_DESCRIPTION = 2_000
FETCH_SECONDS = 15
TEXT_TAGS = frozenset({"title", "p", "li", "h1", "h2", "h3", "h4", "h5", "h6"})
SKIP_TAGS = frozenset({"script", "style", "nav", "footer", "template"})
class DescriptionParser(HTMLParser):
def __init__(self):
super().__init__(convert_charrefs=True)
self.descriptions: dict[str, str] = {}
self.text: list[str] = []
self.remaining = MAX_DESCRIPTION
self.text_tag = ""
self.skipped: list[str] = []
def handle_starttag(self, tag, attrs):
if tag in SKIP_TAGS:
self.skipped.append(tag)
if self.skipped:
return
if tag in TEXT_TAGS:
self.text_tag = tag
if tag != "meta":
return
values = {key.casefold(): value for key, value in attrs}
key = (values.get("name") or values.get("property") or "").casefold()
content = values.get("content")
if key in ("description", "og:description") and content:
self.descriptions.setdefault(key, " ".join(content.split())[:MAX_DESCRIPTION])
def handle_endtag(self, tag):
if self.skipped:
if tag == self.skipped[-1]:
self.skipped.pop()
elif tag == self.text_tag:
self.text_tag = ""
def handle_data(self, data):
if not self.skipped and self.text_tag and self.remaining > 0:
text = " ".join(data.split())[: self.remaining]
if text:
self.text.append(text)
self.remaining -= len(text) + 1
def description(self):
meta = self.descriptions.get("description") or self.descriptions.get("og:description", "")
return " ".join(part for part in (meta, *self.text) if part)[:MAX_DESCRIPTION]
def public_target(url: str):
"""Resolve once, reject nonpublic destinations, and return a pinned address."""
parsed = urllib.parse.urlsplit(url)
if (
parsed.scheme not in ("http", "https")
or not parsed.hostname
or parsed.username is not None
or parsed.password is not None
or any(ord(char) < 33 for char in url)
):
raise ValueError("website must be a public HTTP(S) URL without credentials")
port = parsed.port or (443 if parsed.scheme == "https" else 80)
if port not in (80, 443):
raise ValueError("website uses an unsupported port")
addresses = socket.getaddrinfo(parsed.hostname, port, type=socket.SOCK_STREAM)
if not addresses or any(not ipaddress.ip_address(row[4][0]).is_global for row in addresses):
raise ValueError("website resolves to a nonpublic destination")
addresses.sort(key=lambda row: row[0] != socket.AF_INET)
return parsed, port, str(addresses[0][4][0])
def fetch_description(url: str) -> dict:
"""Bounded child operation. Errors carry only a safe category, never a body."""
try:
for hop in range(4):
parsed, port, address = public_target(url)
assert parsed.hostname is not None
conn = http.client.HTTPConnection(parsed.hostname, port, timeout=8)
try:
conn.sock = socket.create_connection((address, port), timeout=8)
if parsed.scheme == "https":
conn.sock = ssl.create_default_context().wrap_socket(
conn.sock, server_hostname=parsed.hostname
)
target = urllib.parse.urlunsplit(("", "", parsed.path or "/", parsed.query, ""))
conn.request(
"GET",
target,
headers={"Host": parsed.netloc, "User-Agent": "NanoClaw-CFP/1.0"},
)
response = conn.getresponse()
if response.status in (301, 302, 303, 307, 308):
location = response.getheader("Location")
if not location or hop == 3:
return {"description": "", "warning": "website redirect limit"}
url = urllib.parse.urljoin(url, location)
continue
if response.status != 200:
return {"description": "", "warning": f"website HTTP {response.status}"}
if response.headers.get_content_type() not in (
"text/html",
"application/xhtml+xml",
):
return {"description": "", "warning": "website is not HTML"}
body = response.read(MAX_BYTES + 1)
charset = response.headers.get_content_charset() or "utf-8"
parser = DescriptionParser()
parser.feed(body[:MAX_BYTES].decode(charset, errors="replace"))
return {
"description": parser.description(),
"warning": "website preview limited to 256 KiB"
if len(body) > MAX_BYTES
else "",
}
finally:
conn.close()
except (OSError, ValueError, LookupError, http.client.HTTPException):
return {"description": "", "warning": "website metadata unavailable"}
return {"description": "", "warning": "website redirect limit"}.tessl-plugin
skills
check-cfps
references
scripts
conference-followups
nightly-cfp-sync