letitloop 0.2.0__py3-none-any.whl
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.
- letitloop-0.2.0.dist-info/METADATA +232 -0
- letitloop-0.2.0.dist-info/RECORD +175 -0
- letitloop-0.2.0.dist-info/WHEEL +5 -0
- letitloop-0.2.0.dist-info/entry_points.txt +4 -0
- letitloop-0.2.0.dist-info/licenses/LICENSE +21 -0
- letitloop-0.2.0.dist-info/top_level.txt +1 -0
- orchestrator/SKILL.md +292 -0
- orchestrator/__init__.py +151 -0
- orchestrator/anti_ouroboros.py +78 -0
- orchestrator/approval.py +139 -0
- orchestrator/ast_node_splicer.py +130 -0
- orchestrator/ast_splicer.py +94 -0
- orchestrator/audit.py +88 -0
- orchestrator/budget.py +195 -0
- orchestrator/checkpoint.py +248 -0
- orchestrator/cli.py +1971 -0
- orchestrator/codebase_introspector.py +66 -0
- orchestrator/component_slicer.py +185 -0
- orchestrator/config.py +152 -0
- orchestrator/contract.py +404 -0
- orchestrator/dag_validator.py +172 -0
- orchestrator/elasticity_governor.py +80 -0
- orchestrator/env_doctor.py +166 -0
- orchestrator/errors.py +211 -0
- orchestrator/events.py +120 -0
- orchestrator/evidence.py +203 -0
- orchestrator/exceptions.py +37 -0
- orchestrator/experimental/arena_arbiter.py +260 -0
- orchestrator/experimental/fuzz_engine.py +206 -0
- orchestrator/experimental/mutation_tester.py +382 -0
- orchestrator/failure.py +226 -0
- orchestrator/fast_sandbox.py +126 -0
- orchestrator/feasibility_gate.py +115 -0
- orchestrator/feedback.py +302 -0
- orchestrator/fixtures/__init__.py +0 -0
- orchestrator/fixtures/example_contract.json +50 -0
- orchestrator/fixtures/generated/evidence-cli-run-test-step-1.json +47 -0
- orchestrator/fixtures/generated/evidence-cli-run-test-step-2.json +47 -0
- orchestrator/fixtures/generated/evidence-inject-test-a.json +47 -0
- orchestrator/fixtures/generated/evidence-inject-test-b.json +47 -0
- orchestrator/fixtures/generated/evidence-inject-test-c.json +47 -0
- orchestrator/fixtures/generated/evidence-json-test-a.json +47 -0
- orchestrator/fixtures/generated/evidence-json-test-b.json +47 -0
- orchestrator/fixtures/generated/fail-report-fail-task-1.json +47 -0
- orchestrator/fixtures/generated/fail-report-json-task-1.json +47 -0
- orchestrator/fixtures/generated/fail-report-success-task-1.json +47 -0
- orchestrator/fixtures/generated/fuzz-engine-design.json +63 -0
- orchestrator/fixtures/generated/fuzz-engine-impl.json +62 -0
- orchestrator/fixtures/generated/fuzz-engine-tests.json +62 -0
- orchestrator/fixtures/generated/fuzz-engine-verify.json +62 -0
- orchestrator/fixtures/generated/goal-orch-step-1.json +63 -0
- orchestrator/fixtures/generated/goal-orch-step-2.json +62 -0
- orchestrator/fixtures/generated/goal-orch-step-3.json +62 -0
- orchestrator/fixtures/generated/goal-orch-step-4.json +62 -0
- orchestrator/fixtures/generated/goal-orch-step-5.json +62 -0
- orchestrator/fixtures/generated/goal-orch-step-6.json +63 -0
- orchestrator/fixtures/generated/implement-a-thread-safe-token-bucket-rat-task-1.json +53 -0
- orchestrator/fixtures/generated/orchestrator-checkpoint-rollback-3.json +63 -0
- orchestrator/fixtures/generated/orchestrator-checkpoint-rollback.json +62 -0
- orchestrator/fixtures/generated/orchestrator-live-telemetry-2.json +62 -0
- orchestrator/fixtures/generated/orchestrator-live-telemetry.json +62 -0
- orchestrator/fixtures/generated/orchestrator-spec-synthesis-1.json +62 -0
- orchestrator/fixtures/generated/orchestrator-spec-synthesis.json +62 -0
- orchestrator/fixtures/generated/orchestrator-test-verification-4.json +62 -0
- orchestrator/fixtures/generated/orchestrator-test-verification.json +62 -0
- orchestrator/fixtures/generated/perf-step-1.json +61 -0
- orchestrator/fixtures/generated/perf-step-2.json +62 -0
- orchestrator/fixtures/generated/perf-step-3.json +62 -0
- orchestrator/fixtures/generated/perf-step-4.json +62 -0
- orchestrator/fixtures/generated/perf-step-5.json +63 -0
- orchestrator/fixtures/generated/phase2-proof-two-step-step-1.json +47 -0
- orchestrator/fixtures/generated/phase2-proof-two-step-step-2.json +47 -0
- orchestrator/fixtures/generated/planner-spec-synthesis-impl.json +59 -0
- orchestrator/fixtures/generated/self-evolution-ast-formatter.json +69 -0
- orchestrator/fixtures/generated/self-evolution-checkpoint-rollback.json +70 -0
- orchestrator/fixtures/generated/self-evolution-spec-synthesis.json +70 -0
- orchestrator/fixtures/generated/self-evolution-step-1.json +70 -0
- orchestrator/fixtures/generated/self-evolution-step-2.json +70 -0
- orchestrator/fixtures/generated/self-evolution-step-3.json +70 -0
- orchestrator/fixtures/generated/self-evolution-step-4.json +70 -0
- orchestrator/fixtures/generated/self-evolution-step-5.json +65 -0
- orchestrator/fixtures/generated/self-evolution-telemetry.json +70 -0
- orchestrator/fixtures/generated/self-evolution-tests.json +71 -0
- orchestrator/fixtures/generated/spec-telemetry-research-design.json +64 -0
- orchestrator/fixtures/generated/spec-telemetry-step-1.json +62 -0
- orchestrator/fixtures/generated/spec-telemetry-step-2.json +62 -0
- orchestrator/fixtures/generated/spec-telemetry-step-3.json +62 -0
- orchestrator/fixtures/generated/spec-telemetry-step-4.json +62 -0
- orchestrator/fixtures/generated/spec-telemetry-step-5.json +62 -0
- orchestrator/fixtures/generated/spec-telemetry-verification.json +58 -0
- orchestrator/fixtures/generated/token-bucket-impl.json +69 -0
- orchestrator/fixtures/generated/token-bucket-step-1.json +70 -0
- orchestrator/fixtures/generated/token-bucket-step-2.json +70 -0
- orchestrator/fixtures/generated/token-bucket-step-3.json +60 -0
- orchestrator/fixtures/generated/token-bucket-tests.json +70 -0
- orchestrator/fixtures/generated/token-bucket-verify.json +61 -0
- orchestrator/fixtures/generated/trace-ux-tests-step-1.json +64 -0
- orchestrator/fixtures/generated/trace-ux-tests-step-2.json +64 -0
- orchestrator/fixtures/generated/trace-ux-tests-step-3.json +62 -0
- orchestrator/fixtures/generated/tui-live-telemetry-impl.json +59 -0
- orchestrator/fixtures/phase1_proof_escalation_contract.json +41 -0
- orchestrator/fixtures/phase1_proof_happy_path_contract.json +83 -0
- orchestrator/fixtures/phase1_proof_qc_contract.json +41 -0
- orchestrator/fixtures/phase1_proof_repair_contract.json +41 -0
- orchestrator/fixtures/phase2_proof_two_step_goal.json +15 -0
- orchestrator/fixtures/run_proofs.py +299 -0
- orchestrator/fixtures/test_normalizer.py +16 -0
- orchestrator/generator.py +239 -0
- orchestrator/goal.py +245 -0
- orchestrator/handoff.py +86 -0
- orchestrator/hybrid_worker.py +840 -0
- orchestrator/impossibility.py +162 -0
- orchestrator/limits.py +60 -0
- orchestrator/live_evolution_engine.py +247 -0
- orchestrator/llm.py +291 -0
- orchestrator/local_tool_calling.py +285 -0
- orchestrator/lock.py +404 -0
- orchestrator/mcp_client.py +571 -0
- orchestrator/mcp_server.py +344 -0
- orchestrator/memory_bridge.py +182 -0
- orchestrator/metrics.py +159 -0
- orchestrator/micro_epoch.py +42 -0
- orchestrator/models.py +350 -0
- orchestrator/parsing.py +237 -0
- orchestrator/patch_applier.py +154 -0
- orchestrator/plan_preview.py +138 -0
- orchestrator/plan_quality.py +357 -0
- orchestrator/planner.py +532 -0
- orchestrator/preferences.py +115 -0
- orchestrator/preflight.py +141 -0
- orchestrator/process_guard.py +357 -0
- orchestrator/prometheus_exporter.py +207 -0
- orchestrator/prompts.py +275 -0
- orchestrator/proposal_ledger.py +194 -0
- orchestrator/provenance.py +263 -0
- orchestrator/provider_scheduler.py +394 -0
- orchestrator/qc/__init__.py +153 -0
- orchestrator/qc/aggregator.py +330 -0
- orchestrator/qc/parsing.py +287 -0
- orchestrator/qc/personas.py +242 -0
- orchestrator/qc/runner.py +569 -0
- orchestrator/qc_overrule.py +87 -0
- orchestrator/qc_review.py +282 -0
- orchestrator/quality_lenses.py +314 -0
- orchestrator/quality_plan.py +449 -0
- orchestrator/quality_plane.py +103 -0
- orchestrator/reconcile.py +191 -0
- orchestrator/replanner.py +433 -0
- orchestrator/research.py +176 -0
- orchestrator/review_artifact.py +672 -0
- orchestrator/safety.py +271 -0
- orchestrator/schemas.py +230 -0
- orchestrator/scope.py +466 -0
- orchestrator/sensory_radar.py +79 -0
- orchestrator/skill_installer.py +140 -0
- orchestrator/sse_server.py +160 -0
- orchestrator/state.py +871 -0
- orchestrator/subprocess_helper.py +131 -0
- orchestrator/supervisor/__init__.py +184 -0
- orchestrator/supervisor/_shared.py +164 -0
- orchestrator/supervisor/cleanup.py +185 -0
- orchestrator/supervisor/core.py +1680 -0
- orchestrator/supervisor/recovery.py +367 -0
- orchestrator/supervisor/reporting.py +251 -0
- orchestrator/surgical_extractor.py +119 -0
- orchestrator/telemetry.py +61 -0
- orchestrator/templates.py +268 -0
- orchestrator/token_gate.py +245 -0
- orchestrator/tui.py +649 -0
- orchestrator/verifier.py +1103 -0
- orchestrator/webhooks.py +168 -0
- orchestrator/worker.py +469 -0
- orchestrator/worker_adapters.py +815 -0
- orchestrator/worker_pool.py +121 -0
- orchestrator/worktree.py +364 -0
orchestrator/research.py
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"""
|
|
2
|
+
orchestrator/research.py
|
|
3
|
+
Adaptive Multi-Tier Research Engine (DuckDuckGo, arXiv, GitHub API, and MCP Bridges).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import re
|
|
10
|
+
import urllib.parse
|
|
11
|
+
import urllib.request
|
|
12
|
+
import xml.etree.ElementTree as ET
|
|
13
|
+
from abc import ABC, abstractmethod
|
|
14
|
+
from dataclasses import dataclass
|
|
15
|
+
from typing import List, Optional
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclass
|
|
19
|
+
class ResearchFinding:
|
|
20
|
+
title: str
|
|
21
|
+
summary: str
|
|
22
|
+
source_url: str
|
|
23
|
+
provider_name: str
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class BaseResearchProvider(ABC):
|
|
27
|
+
"""Abstract contract for research sources."""
|
|
28
|
+
|
|
29
|
+
@abstractmethod
|
|
30
|
+
def search(self, query: str, max_results: int = 3) -> List[ResearchFinding]:
|
|
31
|
+
pass
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class DuckDuckGoProvider(BaseResearchProvider):
|
|
35
|
+
"""Zero-key public web search provider via DuckDuckGo HTML endpoint."""
|
|
36
|
+
|
|
37
|
+
def search(self, query: str, max_results: int = 3) -> List[ResearchFinding]:
|
|
38
|
+
findings: List[ResearchFinding] = []
|
|
39
|
+
try:
|
|
40
|
+
url = f"https://html.duckduckgo.com/html/?q={urllib.parse.quote(query)}"
|
|
41
|
+
req = urllib.request.Request(
|
|
42
|
+
url,
|
|
43
|
+
headers={
|
|
44
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
|
45
|
+
},
|
|
46
|
+
)
|
|
47
|
+
with urllib.request.urlopen(req, timeout=5.0) as resp: # nosec B310
|
|
48
|
+
html = resp.read().decode("utf-8", errors="replace")
|
|
49
|
+
|
|
50
|
+
# Extract result snippets and URLs
|
|
51
|
+
results = re.findall(
|
|
52
|
+
r'<a[^>]+class="result__snippet[^"]*"[^>]+href="([^"]+)"[^>]*>(.*?)</a>',
|
|
53
|
+
html,
|
|
54
|
+
re.DOTALL,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
for href, snip in results[:max_results]:
|
|
58
|
+
clean_snip = re.sub(r"<[^>]+>", "", snip).strip()
|
|
59
|
+
uddg_match = re.search(r"uddg=([^&]+)", href)
|
|
60
|
+
clean_url = urllib.parse.unquote(uddg_match.group(1)) if uddg_match else href
|
|
61
|
+
title = clean_url.split("/")[-1] or "Web Result"
|
|
62
|
+
if clean_snip:
|
|
63
|
+
findings.append(
|
|
64
|
+
ResearchFinding(
|
|
65
|
+
title=title,
|
|
66
|
+
summary=clean_snip,
|
|
67
|
+
source_url=clean_url,
|
|
68
|
+
provider_name="DuckDuckGo",
|
|
69
|
+
)
|
|
70
|
+
)
|
|
71
|
+
except Exception:
|
|
72
|
+
pass
|
|
73
|
+
return findings
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class ArXivProvider(BaseResearchProvider):
|
|
77
|
+
"""Zero-key academic paper search provider via arXiv public Atom/XML API."""
|
|
78
|
+
|
|
79
|
+
def search(self, query: str, max_results: int = 3) -> List[ResearchFinding]:
|
|
80
|
+
findings: List[ResearchFinding] = []
|
|
81
|
+
try:
|
|
82
|
+
encoded_query = urllib.parse.quote(f"all:{query}")
|
|
83
|
+
url = f"https://export.arxiv.org/api/query?search_query={encoded_query}&start=0&max_results={max_results}"
|
|
84
|
+
req = urllib.request.Request(url, headers={"User-Agent": "LetItLoop/0.1"})
|
|
85
|
+
with urllib.request.urlopen(req, timeout=5.0) as resp: # nosec B310
|
|
86
|
+
xml_data = resp.read().decode("utf-8", errors="replace")
|
|
87
|
+
|
|
88
|
+
root = ET.fromstring(xml_data) # nosec B314
|
|
89
|
+
ns = {"atom": "http://www.w3.org/2005/Atom"}
|
|
90
|
+
for entry in root.findall("atom:entry", ns):
|
|
91
|
+
title_node = entry.find("atom:title", ns)
|
|
92
|
+
summary_node = entry.find("atom:summary", ns)
|
|
93
|
+
id_node = entry.find("atom:id", ns)
|
|
94
|
+
|
|
95
|
+
title = title_node.text.strip() if title_node is not None and title_node.text else "arXiv Paper"
|
|
96
|
+
summary = (
|
|
97
|
+
summary_node.text.strip().replace("\n", " ")
|
|
98
|
+
if summary_node is not None and summary_node.text
|
|
99
|
+
else ""
|
|
100
|
+
)
|
|
101
|
+
source_url = id_node.text.strip() if id_node is not None and id_node.text else ""
|
|
102
|
+
|
|
103
|
+
findings.append(
|
|
104
|
+
ResearchFinding(
|
|
105
|
+
title=title,
|
|
106
|
+
summary=summary[:300] + ("..." if len(summary) > 300 else ""),
|
|
107
|
+
source_url=source_url,
|
|
108
|
+
provider_name="arXiv",
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
except Exception:
|
|
112
|
+
pass
|
|
113
|
+
return findings
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class GitHubSearchProvider(BaseResearchProvider):
|
|
117
|
+
"""Zero-key public GitHub repository search provider via GitHub REST API."""
|
|
118
|
+
|
|
119
|
+
def search(self, query: str, max_results: int = 3) -> List[ResearchFinding]:
|
|
120
|
+
findings: List[ResearchFinding] = []
|
|
121
|
+
try:
|
|
122
|
+
url = f"https://api.github.com/search/repositories?q={urllib.parse.quote(query)}&sort=stars&order=desc&per_page={max_results}"
|
|
123
|
+
req = urllib.request.Request(
|
|
124
|
+
url,
|
|
125
|
+
headers={
|
|
126
|
+
"User-Agent": "LetItLoop/0.1",
|
|
127
|
+
"Accept": "application/vnd.github.v3+json",
|
|
128
|
+
},
|
|
129
|
+
)
|
|
130
|
+
with urllib.request.urlopen(req, timeout=5.0) as resp: # nosec B310
|
|
131
|
+
raw_json = resp.read().decode("utf-8", errors="replace")
|
|
132
|
+
data = json.loads(raw_json)
|
|
133
|
+
|
|
134
|
+
for item in data.get("items", [])[:max_results]:
|
|
135
|
+
findings.append(
|
|
136
|
+
ResearchFinding(
|
|
137
|
+
title=item.get("full_name", "GitHub Repo"),
|
|
138
|
+
summary=item.get("description", "No description provided.") or "",
|
|
139
|
+
source_url=item.get("html_url", ""),
|
|
140
|
+
provider_name="GitHub",
|
|
141
|
+
)
|
|
142
|
+
)
|
|
143
|
+
except Exception:
|
|
144
|
+
pass
|
|
145
|
+
return findings
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class NoOpResearchProvider(BaseResearchProvider):
|
|
149
|
+
"""Safe offline fallback that returns empty findings with zero network activity."""
|
|
150
|
+
|
|
151
|
+
def search(self, query: str, max_results: int = 3) -> List[ResearchFinding]:
|
|
152
|
+
return []
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class AdaptiveResearchCoordinator:
|
|
156
|
+
"""Coordinates multi-tier research providers with automatic graceful fallback."""
|
|
157
|
+
|
|
158
|
+
def __init__(self, providers: Optional[List[BaseResearchProvider]] = None):
|
|
159
|
+
if providers is not None:
|
|
160
|
+
self.providers = providers
|
|
161
|
+
else:
|
|
162
|
+
self.providers = [
|
|
163
|
+
GitHubSearchProvider(),
|
|
164
|
+
ArXivProvider(),
|
|
165
|
+
DuckDuckGoProvider(),
|
|
166
|
+
]
|
|
167
|
+
|
|
168
|
+
def research(self, topic: str, max_results_per_provider: int = 2) -> List[ResearchFinding]:
|
|
169
|
+
aggregated: List[ResearchFinding] = []
|
|
170
|
+
for provider in self.providers:
|
|
171
|
+
try:
|
|
172
|
+
results = provider.search(topic, max_results=max_results_per_provider)
|
|
173
|
+
aggregated.extend(results)
|
|
174
|
+
except Exception:
|
|
175
|
+
continue
|
|
176
|
+
return aggregated
|