devez-vibe 1.10.21 → 1.11.1
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/LICENSE +21 -21
- package/README.md +73 -73
- package/bin/dvz.exe +0 -0
- package/bin/dvz.js +35 -35
- package/bridge/claude-agent-sdk-bridge.mjs +364 -35
- package/install-skills.mjs +11 -11
- package/package.json +50 -50
- package/prepare-search-deps.mjs +42 -42
- package/skills/insane-search/SKILL.md +36 -36
- package/skills/insane-search/engine/__main__.py +44 -44
- package/skills/insane-search/engine/executor.py +246 -246
- package/skills/insane-search/engine/fetch_chain.py +443 -443
- package/skills/insane-search/engine/network.py +108 -108
- package/skills/insane-search/engine/phase0.py +380 -380
- package/skills/insane-search/engine/session_input.py +120 -120
- package/skills/insane-search/engine/templates/invisible_playwright_fetch.py +57 -57
- package/skills/insane-search/engine/templates/nodriver_fetch.py +9 -9
- package/skills/insane-search/engine/templates/patchright_fetch.py +9 -9
- package/skills/insane-search/engine/templates/playwright_mobile_chrome.js +9 -9
- package/skills/insane-search/engine/templates/playwright_real_chrome.js +7 -7
- package/skills/insane-search/engine/templates/scrapling_fetch.py +46 -46
- package/skills/insane-search/engine/tests/test_smoke.py +8 -8
- package/skills/insane-search/engine/tests/test_t10_artifact_routes.py +126 -126
- package/skills/insane-search/engine/tests/test_t11_session_handoff.py +157 -157
- package/skills/insane-search/engine/tests/test_t5_pdfplumber.py +11 -11
- package/skills/insane-search/engine/tests/test_t7_browser_gate.py +3 -3
- package/skills/insane-search/engine/tests/test_t8_network_routes.py +207 -207
- package/skills/insane-search/engine/tests/test_t9_evidence_bundle.py +89 -89
- package/skills/insane-search/engine/tests/test_u5.py +9 -9
- package/skills/insane-search/engine/transport.py +94 -94
- package/skills/insane-search/engine/waf_profiles.yaml +38 -38
- package/skills/insane-search/references/cache-archive.md +13 -13
- package/skills/insane-search/references/media.md +14 -14
- package/skills/insane-search/references/playwright.md +27 -27
- package/skills/insane-search/references/research-evidence.md +36 -36
- package/skills/insane-search/references/session-handoff.md +26 -26
- package/skills/insane-search/tests/test_x_search.py +3 -3
- package/skills/luna-loop/agents/openai.yaml +7 -7
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
"""Network-route validation and failure-layer diagnosis."""
|
|
2
|
-
from __future__ import annotations
|
|
3
|
-
|
|
4
|
-
import hashlib
|
|
5
|
-
from typing import Any, Optional
|
|
6
|
-
from urllib.parse import unquote, urlsplit
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
_PROXY_SCHEMES = frozenset({"http", "https", "socks4", "socks4a", "socks5", "socks5h"})
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def normalize_proxy(value: Optional[str]) -> Optional[str]:
|
|
13
|
-
"""Validate an explicitly supplied proxy URL and return its trimmed form."""
|
|
14
|
-
if value is None:
|
|
15
|
-
return None
|
|
16
|
-
value = value.strip()
|
|
17
|
-
if not value:
|
|
18
|
-
return None
|
|
19
|
-
if any(ord(char) < 0x20 for char in value):
|
|
20
|
-
raise ValueError("proxy URL contains control characters")
|
|
21
|
-
try:
|
|
22
|
-
parsed = urlsplit(value)
|
|
23
|
-
port = parsed.port
|
|
24
|
-
except ValueError as exc:
|
|
25
|
-
raise ValueError("proxy URL has an invalid port") from exc
|
|
26
|
-
if parsed.scheme.lower() not in _PROXY_SCHEMES:
|
|
27
|
-
raise ValueError("proxy URL must use HTTP, HTTPS, SOCKS4, or SOCKS5")
|
|
28
|
-
if not parsed.hostname or port is None:
|
|
29
|
-
raise ValueError("proxy URL must include a host and port")
|
|
30
|
-
if parsed.path not in ("", "/") or parsed.query or parsed.fragment:
|
|
31
|
-
raise ValueError("proxy URL cannot contain a path, query, or fragment")
|
|
32
|
-
credentials = "".join(unquote(part or "") for part in (parsed.username, parsed.password))
|
|
33
|
-
if any(ord(char) < 0x20 for char in credentials):
|
|
34
|
-
raise ValueError("proxy credentials contain control characters")
|
|
35
|
-
return value
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def proxy_cache_key(proxy: Optional[str]) -> str:
|
|
39
|
-
"""Opaque pool key: credentials never appear in diagnostics or statistics."""
|
|
40
|
-
if not proxy:
|
|
41
|
-
return "direct"
|
|
42
|
-
return hashlib.sha256(proxy.encode("utf-8", "surrogatepass")).hexdigest()[:20]
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def proxy_for_browser(proxy: Optional[str]) -> Optional[dict[str, str]]:
|
|
46
|
-
"""Convert a validated URL to Playwright's proxy object."""
|
|
47
|
-
proxy = normalize_proxy(proxy)
|
|
48
|
-
if not proxy:
|
|
49
|
-
return None
|
|
50
|
-
parsed = urlsplit(proxy)
|
|
51
|
-
host = parsed.hostname or ""
|
|
52
|
-
if ":" in host:
|
|
53
|
-
host = f"[{host}]"
|
|
54
|
-
browser_scheme = {"socks5h": "socks5", "socks4a": "socks4"}.get(
|
|
55
|
-
parsed.scheme.lower(), parsed.scheme.lower())
|
|
56
|
-
result = {"server": f"{browser_scheme}://{host}:{parsed.port}"}
|
|
57
|
-
if parsed.username is not None:
|
|
58
|
-
result["username"] = unquote(parsed.username)
|
|
59
|
-
if parsed.password is not None:
|
|
60
|
-
result["password"] = unquote(parsed.password)
|
|
61
|
-
return result
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def redact_proxy(text: Optional[str], proxy: Optional[str]) -> Optional[str]:
|
|
65
|
-
"""Remove a proxy URL and either encoded or decoded credentials from errors."""
|
|
66
|
-
if text is None or not proxy:
|
|
67
|
-
return text
|
|
68
|
-
parsed = urlsplit(proxy)
|
|
69
|
-
public = proxy_for_browser(proxy)["server"]
|
|
70
|
-
redacted = text.replace(proxy, public)
|
|
71
|
-
for value in (parsed.username, parsed.password):
|
|
72
|
-
if not value:
|
|
73
|
-
continue
|
|
74
|
-
redacted = redacted.replace(value, "***")
|
|
75
|
-
redacted = redacted.replace(unquote(value), "***")
|
|
76
|
-
return redacted
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
def diagnose_trace(trace: list[Any]) -> dict[str, Any]:
|
|
80
|
-
"""Infer the failed network layer from already collected attempts."""
|
|
81
|
-
errors = [str(getattr(attempt, "error", "") or "").lower() for attempt in trace]
|
|
82
|
-
statuses = [int(getattr(attempt, "status", 0) or 0) for attempt in trace]
|
|
83
|
-
verdicts = [str(getattr(attempt, "verdict", "") or "").lower() for attempt in trace]
|
|
84
|
-
|
|
85
|
-
if any(token in error for error in errors for token in (
|
|
86
|
-
"certificateverifyerror", "certificate verify", "ssl certificate", "curl: (60)")):
|
|
87
|
-
return _diagnosis("tls", "certificate_verification", "fix_ca_or_use_system_browser")
|
|
88
|
-
if any(token in error for error in errors for token in (
|
|
89
|
-
"could not resolve", "name or service not known", "nodename nor servname", "gaierror")):
|
|
90
|
-
return _diagnosis("dns", "resolution_failed", "check_dns_or_use_remote_dns_proxy")
|
|
91
|
-
if any(token in error for error in errors for token in (
|
|
92
|
-
"connection refused", "connection reset", "network is unreachable", "no route to host")):
|
|
93
|
-
return _diagnosis("tcp", "connection_failed", "check_firewall_or_use_approved_proxy")
|
|
94
|
-
if any(token in error for error in errors for token in ("timed out", "timeout")):
|
|
95
|
-
return _diagnosis("transport", "timeout", "check_route_or_retry_with_backoff")
|
|
96
|
-
if 429 in statuses or "rate_limited" in verdicts:
|
|
97
|
-
return _diagnosis("http_policy", "rate_limited", "backoff_before_retry")
|
|
98
|
-
if any(status in (401, 407) for status in statuses) or "auth_required" in verdicts:
|
|
99
|
-
return _diagnosis("authentication", "credentials_required", "request_user_authentication")
|
|
100
|
-
if 403 in statuses or any(verdict in ("blocked", "challenge", "suspect_ok") for verdict in verdicts):
|
|
101
|
-
return _diagnosis("http_policy", "waf_or_access_policy", "try_browser_or_approved_proxy")
|
|
102
|
-
if 404 in statuses or "not_found" in verdicts:
|
|
103
|
-
return _diagnosis("http", "not_found", "verify_url")
|
|
104
|
-
return _diagnosis("unknown", "insufficient_signal", "inspect_trace")
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
def _diagnosis(layer: str, category: str, next_action: str) -> dict[str, str]:
|
|
108
|
-
return {"layer": layer, "category": category, "next_action": next_action}
|
|
1
|
+
"""Network-route validation and failure-layer diagnosis."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import hashlib
|
|
5
|
+
from typing import Any, Optional
|
|
6
|
+
from urllib.parse import unquote, urlsplit
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
_PROXY_SCHEMES = frozenset({"http", "https", "socks4", "socks4a", "socks5", "socks5h"})
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def normalize_proxy(value: Optional[str]) -> Optional[str]:
|
|
13
|
+
"""Validate an explicitly supplied proxy URL and return its trimmed form."""
|
|
14
|
+
if value is None:
|
|
15
|
+
return None
|
|
16
|
+
value = value.strip()
|
|
17
|
+
if not value:
|
|
18
|
+
return None
|
|
19
|
+
if any(ord(char) < 0x20 for char in value):
|
|
20
|
+
raise ValueError("proxy URL contains control characters")
|
|
21
|
+
try:
|
|
22
|
+
parsed = urlsplit(value)
|
|
23
|
+
port = parsed.port
|
|
24
|
+
except ValueError as exc:
|
|
25
|
+
raise ValueError("proxy URL has an invalid port") from exc
|
|
26
|
+
if parsed.scheme.lower() not in _PROXY_SCHEMES:
|
|
27
|
+
raise ValueError("proxy URL must use HTTP, HTTPS, SOCKS4, or SOCKS5")
|
|
28
|
+
if not parsed.hostname or port is None:
|
|
29
|
+
raise ValueError("proxy URL must include a host and port")
|
|
30
|
+
if parsed.path not in ("", "/") or parsed.query or parsed.fragment:
|
|
31
|
+
raise ValueError("proxy URL cannot contain a path, query, or fragment")
|
|
32
|
+
credentials = "".join(unquote(part or "") for part in (parsed.username, parsed.password))
|
|
33
|
+
if any(ord(char) < 0x20 for char in credentials):
|
|
34
|
+
raise ValueError("proxy credentials contain control characters")
|
|
35
|
+
return value
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def proxy_cache_key(proxy: Optional[str]) -> str:
|
|
39
|
+
"""Opaque pool key: credentials never appear in diagnostics or statistics."""
|
|
40
|
+
if not proxy:
|
|
41
|
+
return "direct"
|
|
42
|
+
return hashlib.sha256(proxy.encode("utf-8", "surrogatepass")).hexdigest()[:20]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def proxy_for_browser(proxy: Optional[str]) -> Optional[dict[str, str]]:
|
|
46
|
+
"""Convert a validated URL to Playwright's proxy object."""
|
|
47
|
+
proxy = normalize_proxy(proxy)
|
|
48
|
+
if not proxy:
|
|
49
|
+
return None
|
|
50
|
+
parsed = urlsplit(proxy)
|
|
51
|
+
host = parsed.hostname or ""
|
|
52
|
+
if ":" in host:
|
|
53
|
+
host = f"[{host}]"
|
|
54
|
+
browser_scheme = {"socks5h": "socks5", "socks4a": "socks4"}.get(
|
|
55
|
+
parsed.scheme.lower(), parsed.scheme.lower())
|
|
56
|
+
result = {"server": f"{browser_scheme}://{host}:{parsed.port}"}
|
|
57
|
+
if parsed.username is not None:
|
|
58
|
+
result["username"] = unquote(parsed.username)
|
|
59
|
+
if parsed.password is not None:
|
|
60
|
+
result["password"] = unquote(parsed.password)
|
|
61
|
+
return result
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def redact_proxy(text: Optional[str], proxy: Optional[str]) -> Optional[str]:
|
|
65
|
+
"""Remove a proxy URL and either encoded or decoded credentials from errors."""
|
|
66
|
+
if text is None or not proxy:
|
|
67
|
+
return text
|
|
68
|
+
parsed = urlsplit(proxy)
|
|
69
|
+
public = proxy_for_browser(proxy)["server"]
|
|
70
|
+
redacted = text.replace(proxy, public)
|
|
71
|
+
for value in (parsed.username, parsed.password):
|
|
72
|
+
if not value:
|
|
73
|
+
continue
|
|
74
|
+
redacted = redacted.replace(value, "***")
|
|
75
|
+
redacted = redacted.replace(unquote(value), "***")
|
|
76
|
+
return redacted
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def diagnose_trace(trace: list[Any]) -> dict[str, Any]:
|
|
80
|
+
"""Infer the failed network layer from already collected attempts."""
|
|
81
|
+
errors = [str(getattr(attempt, "error", "") or "").lower() for attempt in trace]
|
|
82
|
+
statuses = [int(getattr(attempt, "status", 0) or 0) for attempt in trace]
|
|
83
|
+
verdicts = [str(getattr(attempt, "verdict", "") or "").lower() for attempt in trace]
|
|
84
|
+
|
|
85
|
+
if any(token in error for error in errors for token in (
|
|
86
|
+
"certificateverifyerror", "certificate verify", "ssl certificate", "curl: (60)")):
|
|
87
|
+
return _diagnosis("tls", "certificate_verification", "fix_ca_or_use_system_browser")
|
|
88
|
+
if any(token in error for error in errors for token in (
|
|
89
|
+
"could not resolve", "name or service not known", "nodename nor servname", "gaierror")):
|
|
90
|
+
return _diagnosis("dns", "resolution_failed", "check_dns_or_use_remote_dns_proxy")
|
|
91
|
+
if any(token in error for error in errors for token in (
|
|
92
|
+
"connection refused", "connection reset", "network is unreachable", "no route to host")):
|
|
93
|
+
return _diagnosis("tcp", "connection_failed", "check_firewall_or_use_approved_proxy")
|
|
94
|
+
if any(token in error for error in errors for token in ("timed out", "timeout")):
|
|
95
|
+
return _diagnosis("transport", "timeout", "check_route_or_retry_with_backoff")
|
|
96
|
+
if 429 in statuses or "rate_limited" in verdicts:
|
|
97
|
+
return _diagnosis("http_policy", "rate_limited", "backoff_before_retry")
|
|
98
|
+
if any(status in (401, 407) for status in statuses) or "auth_required" in verdicts:
|
|
99
|
+
return _diagnosis("authentication", "credentials_required", "request_user_authentication")
|
|
100
|
+
if 403 in statuses or any(verdict in ("blocked", "challenge", "suspect_ok") for verdict in verdicts):
|
|
101
|
+
return _diagnosis("http_policy", "waf_or_access_policy", "try_browser_or_approved_proxy")
|
|
102
|
+
if 404 in statuses or "not_found" in verdicts:
|
|
103
|
+
return _diagnosis("http", "not_found", "verify_url")
|
|
104
|
+
return _diagnosis("unknown", "insufficient_signal", "inspect_trace")
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def _diagnosis(layer: str, category: str, next_action: str) -> dict[str, str]:
|
|
108
|
+
return {"layer": layer, "category": category, "next_action": next_action}
|