behive 0.2.1__tar.gz → 0.2.2__tar.gz

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.
Files changed (43) hide show
  1. {behive-0.2.1/src/behive.egg-info → behive-0.2.2}/PKG-INFO +1 -1
  2. {behive-0.2.1 → behive-0.2.2}/pyproject.toml +1 -1
  3. {behive-0.2.1 → behive-0.2.2}/src/behive/__init__.py +1 -1
  4. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/__main__.py +1 -1
  5. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/bionic_quorum.py +8 -3
  6. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/db.py +17 -12
  7. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/domain_reputation.py +5 -3
  8. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/drones.py +11 -4
  9. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/events.py +5 -2
  10. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/guardrail.py +7 -1
  11. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/harvest.py +13 -7
  12. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/orchestrator.py +10 -7
  13. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/preprocessor.py +3 -0
  14. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/prescout.py +14 -6
  15. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/process.py +31 -12
  16. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/quality.py +2 -0
  17. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/queen_calibrator.py +5 -2
  18. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/queen_fact_mem.py +3 -0
  19. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/queen_memory.py +2 -0
  20. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/queen_primer.py +2 -1
  21. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/scout.py +6 -2
  22. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/synth.py +41 -22
  23. {behive-0.2.1 → behive-0.2.2/src/behive.egg-info}/PKG-INFO +1 -1
  24. {behive-0.2.1 → behive-0.2.2}/tests/test_smoke.py +2 -2
  25. {behive-0.2.1 → behive-0.2.2}/LICENSE +0 -0
  26. {behive-0.2.1 → behive-0.2.2}/README.md +0 -0
  27. {behive-0.2.1 → behive-0.2.2}/setup.cfg +0 -0
  28. {behive-0.2.1 → behive-0.2.2}/src/behive/cli.py +0 -0
  29. {behive-0.2.1 → behive-0.2.2}/src/behive/client.py +0 -0
  30. {behive-0.2.1 → behive-0.2.2}/src/behive/compat/__init__.py +0 -0
  31. {behive-0.2.1 → behive-0.2.2}/src/behive/compat/shims.py +0 -0
  32. {behive-0.2.1 → behive-0.2.2}/src/behive/config.py +0 -0
  33. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/__init__.py +0 -0
  34. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/api_scout.py +0 -0
  35. {behive-0.2.1 → behive-0.2.2}/src/behive/engine/constants.py +0 -0
  36. {behive-0.2.1 → behive-0.2.2}/src/behive/mcp_server.py +0 -0
  37. {behive-0.2.1 → behive-0.2.2}/src/behive/models.py +0 -0
  38. {behive-0.2.1 → behive-0.2.2}/src/behive/server.py +0 -0
  39. {behive-0.2.1 → behive-0.2.2}/src/behive.egg-info/SOURCES.txt +0 -0
  40. {behive-0.2.1 → behive-0.2.2}/src/behive.egg-info/dependency_links.txt +0 -0
  41. {behive-0.2.1 → behive-0.2.2}/src/behive.egg-info/entry_points.txt +0 -0
  42. {behive-0.2.1 → behive-0.2.2}/src/behive.egg-info/requires.txt +0 -0
  43. {behive-0.2.1 → behive-0.2.2}/src/behive.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: behive
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Research engine that builds structured knowledge graphs from any topic
5
5
  Author-email: QA10 <hello@qa10.io>
6
6
  License-Expression: MIT
@@ -7,7 +7,7 @@ where = ["src"]
7
7
 
8
8
  [project]
9
9
  name = "behive"
10
- version = "0.2.1"
10
+ version = "0.2.2"
11
11
  description = "Research engine that builds structured knowledge graphs from any topic"
12
12
  readme = "README.md"
13
13
  license = "MIT"
@@ -10,7 +10,7 @@ Usage:
10
10
  print(result.report) # Synthesized markdown report
11
11
  """
12
12
 
13
- __version__ = "0.2.1"
13
+ __version__ = "0.2.2"
14
14
 
15
15
  from behive.client import research, BeHiveClient
16
16
  from behive.models import ResearchResult, Claim, Entity
@@ -16,7 +16,7 @@ except ImportError:
16
16
  from behive.engine.orchestrator import cmd_run
17
17
 
18
18
 
19
- def main():
19
+ def main() -> None:
20
20
  """CLI entry point for running research from the command line."""
21
21
  if len(sys.argv) < 2:
22
22
  print("Usage: python -m behive.engine 'research topic'")
@@ -65,6 +65,7 @@ EXPANSION_QUERIES = 5 # ile dodatkowych queries per expansion
65
65
 
66
66
  @dataclass
67
67
  class QuorumResult:
68
+ """Bionic quorum voting result with confidence and expansion queries."""
68
69
  mission_id: str
69
70
  harvestable_count: int
70
71
  total_sources: int
@@ -76,6 +77,7 @@ class QuorumResult:
76
77
  report: str = ""
77
78
 
78
79
  def summary(self) -> str:
80
+ """Return human-readable summary of the quorum result."""
79
81
  status = "✅ QUORUM MET" if self.quorum_met else "⚠️ QUORUM FAILED"
80
82
  exp = f" → expansion round {self.expansion_round + 1}" if self.needs_expansion else ""
81
83
  return (
@@ -117,7 +119,8 @@ class QuorumChecker:
117
119
  ).fetchone()
118
120
  con.close()
119
121
  return row[0] if row else ""
120
- except Exception:
122
+ except Exception as e:
123
+ log.debug(f"Suppressed in bionic_quorum.py: {e}")
121
124
  return ""
122
125
 
123
126
  def _load_expansion_count(self) -> int:
@@ -130,7 +133,8 @@ class QuorumChecker:
130
133
  """, [self.mission_id]).fetchone()
131
134
  con.close()
132
135
  return row[0] if row else 0
133
- except Exception:
136
+ except Exception as e:
137
+ log.debug(f"Suppressed in bionic_quorum.py: {e}")
134
138
  return 0
135
139
 
136
140
  def check(self) -> QuorumResult:
@@ -157,7 +161,8 @@ class QuorumChecker:
157
161
  WHERE mission_id = ?
158
162
  AND routing_decision = 'skip'
159
163
  """, [self.mission_id]).fetchone()[0]
160
- except Exception:
164
+ except Exception as e:
165
+ log.debug(f"Suppressed in bionic_quorum.py: {e}")
161
166
  skip_count = 0
162
167
 
163
168
  con.close()
@@ -71,7 +71,7 @@ def get_pg_connection() -> psycopg2.extensions.connection:
71
71
 
72
72
 
73
73
  @contextmanager
74
- def pg_connection():
74
+ def pg_connection() -> object:
75
75
  """Context manager for pooled connections. Auto-returns to pool."""
76
76
  pool = get_pg_pool()
77
77
  conn = pool.getconn()
@@ -86,7 +86,7 @@ def pg_connection():
86
86
 
87
87
 
88
88
  @contextmanager
89
- def pg_cursor(commit: bool = True):
89
+ def pg_cursor(commit: bool = True) -> object:
90
90
  """Context manager for a cursor with auto-commit/rollback."""
91
91
  with pg_connection() as conn:
92
92
  cur = conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor)
@@ -142,7 +142,8 @@ class PgConnection:
142
142
  raise
143
143
  return self
144
144
 
145
- def fetchone(self):
145
+ def fetchone(self) -> tuple | None:
146
+ """Execute query and return first row or None."""
146
147
  if self._cursor:
147
148
  return self._cursor.fetchone()
148
149
  return None
@@ -170,12 +171,13 @@ class PgConnection:
170
171
  raise
171
172
  return self
172
173
 
173
- def fetchall(self):
174
+ def fetchall(self) -> list:
175
+ """Execute query and return all rows."""
174
176
  if self._cursor:
175
177
  return self._cursor.fetchall()
176
178
  return []
177
179
 
178
- def fetchdf(self):
180
+ def fetchdf(self) -> object:
179
181
  """DuckDB .fetchdf() compatibility → returns pandas DataFrame."""
180
182
  import pandas as pd
181
183
  if self._cursor:
@@ -185,19 +187,22 @@ class PgConnection:
185
187
  return pd.DataFrame()
186
188
 
187
189
  @property
188
- def description(self):
190
+ def description(self) -> list | None:
189
191
  """Cursor description (column names + types)."""
190
192
  if self._cursor:
191
193
  return self._cursor.description
192
194
  return None
193
195
 
194
- def commit(self):
196
+ def commit(self) -> None:
197
+ """Commit the current transaction."""
195
198
  self._conn.commit()
196
199
 
197
- def rollback(self):
200
+ def rollback(self) -> None:
201
+ """Rollback the current transaction."""
198
202
  self._conn.rollback()
199
203
 
200
- def close(self):
204
+ def close(self) -> None:
205
+ """Close the database connection."""
201
206
  if self._cursor:
202
207
  self._cursor.close()
203
208
  self._cursor = None
@@ -205,7 +210,7 @@ class PgConnection:
205
210
  self._pool.putconn(self._conn)
206
211
  self._conn = None
207
212
 
208
- def cursor(self):
213
+ def cursor(self) -> object:
209
214
  """Return a new cursor (DuckDB .cursor() compat)."""
210
215
  return self._conn.cursor()
211
216
 
@@ -248,7 +253,7 @@ def connect(database: str = None, read_only: bool = False) -> PgConnection:
248
253
 
249
254
  # ─── Utility Functions ─────────────────────────────────────────────────────
250
255
 
251
- def insert_batch(table: str, rows: list[dict], on_conflict: str = "DO NOTHING"):
256
+ def insert_batch(table: str, rows: list[dict], on_conflict: str = "DO NOTHING") -> None:
252
257
  """Batch insert with ON CONFLICT handling."""
253
258
  if not rows:
254
259
  return 0
@@ -270,7 +275,7 @@ def insert_batch(table: str, rows: list[dict], on_conflict: str = "DO NOTHING"):
270
275
  return len(values)
271
276
 
272
277
 
273
- def upsert_batch(table: str, rows: list[dict], conflict_cols: list[str], update_cols: list[str] = None):
278
+ def upsert_batch(table: str, rows: list[dict], conflict_cols: list[str], update_cols: list[str] = None) -> None:
274
279
  """Batch upsert (INSERT ... ON CONFLICT ... DO UPDATE)."""
275
280
  if not rows:
276
281
  return 0
@@ -88,7 +88,8 @@ def _extract_domain(url: str) -> str:
88
88
  # strip port
89
89
  domain = domain.split(":")[0]
90
90
  return domain
91
- except Exception:
91
+ except Exception as e:
92
+ log.debug(f"Suppressed in domain_reputation.py: {e}")
92
93
  return url[:100]
93
94
 
94
95
 
@@ -211,7 +212,7 @@ class DomainReputation:
211
212
  # PUBLIC WRITE API
212
213
  # ─────────────────────────────────────────────────────────────────────
213
214
 
214
- def update(self, url: str, quality_score: float, success: bool = True):
215
+ def update(self, url: str, quality_score: float, success: bool = True) -> None:
215
216
  """
216
217
  Rejestruje wynik harvestu dla domeny.
217
218
  Wywoływać po każdym _harvest_one() w HarvesterBee.
@@ -249,7 +250,7 @@ class DomainReputation:
249
250
  self._cache[domain]["consecutive_bad"] + 1 if is_bad else 0
250
251
  )
251
252
 
252
- def flush(self):
253
+ def flush(self) -> None:
253
254
  """
254
255
  Commits all pending updates to database.
255
256
  Wywołaj po zakończeniu harvest misji.
@@ -401,6 +402,7 @@ _global_rep: Optional[DomainReputation] = None
401
402
 
402
403
 
403
404
  def get_reputation() -> DomainReputation:
405
+ """Get domain reputation score and history."""
404
406
  global _global_rep
405
407
  if _global_rep is None:
406
408
  _global_rep = DomainReputation()
@@ -207,6 +207,7 @@ SPECIAL_HANDLERS = {
207
207
  # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
208
208
 
209
209
  class ReconResult:
210
+ """Domain reconnaissance result: status, content type, headers, timing."""
210
211
  def __init__(self, domain: str):
211
212
  self.domain = domain
212
213
  self.strategy = "DIRECT"
@@ -226,6 +227,7 @@ class ReconResult:
226
227
  self.notes: list[str] = []
227
228
 
228
229
  def to_dict(self) -> dict:
230
+ """Serialize to dictionary."""
229
231
  return {
230
232
  "domain": self.domain,
231
233
  "strategy": self.strategy,
@@ -426,7 +428,8 @@ class DroneRecon:
426
428
  status, body, ms = await loop.run_in_executor(None, _do)
427
429
  if status == 200 and not self._detect_block(status, body):
428
430
  return True, target, status, body, ms
429
- except Exception:
431
+ except Exception as e:
432
+ log.debug(f"Suppressed in drones.py: {e}")
430
433
  continue
431
434
  return False, "", 0, "all cffi failed", 0
432
435
 
@@ -460,7 +463,8 @@ class DroneRecon:
460
463
  status, body, ms = await loop.run_in_executor(None, _do)
461
464
  if status == 200 and not self._detect_block(status, body):
462
465
  return True, target, status, body, ms
463
- except Exception:
466
+ except Exception as e:
467
+ log.debug(f"Suppressed in drones.py: {e}")
464
468
  continue
465
469
  return False, "", 0, "all primp failed", 0
466
470
 
@@ -711,6 +715,7 @@ class DroneRecon:
711
715
  # ── Main recon loop ────────────────────────────────────────────────────
712
716
 
713
717
  async def recon(self, domains: list[str]) -> dict[str, ReconResult]:
718
+ """Perform full domain reconnaissance."""
714
719
  log.info(f"[TRUTNIE v2.0] Starting 8-level recon — {len(domains)} domains")
715
720
 
716
721
  tasks = [self._recon_domain(d) for d in domains]
@@ -743,7 +748,8 @@ class DroneRecon:
743
748
 
744
749
  # ── Save to DuckDB ────────────────────────────────────────────────────────
745
750
 
746
- def save_to_db(self):
751
+ def save_to_db(self) -> None:
752
+ """Persist recon results to database."""
747
753
  import hive2_db as _hive_db
748
754
  db = _hive_db.connect(read_only=False)
749
755
  rows = []
@@ -782,7 +788,7 @@ class DroneRecon:
782
788
 
783
789
  # ── Retreat — covering tracks ───────────────────────────────────────────
784
790
 
785
- def retreat(self):
791
+ def retreat(self) -> None:
786
792
  """Trutnie wycofują się — czyszczą identyfikatory."""
787
793
  self._cookie_jar.clear()
788
794
 
@@ -799,6 +805,7 @@ class DroneRecon:
799
805
  # ── Report ────────────────────────────────────────────────────────────────
800
806
 
801
807
  def report(self) -> dict:
808
+ """Generate human-readable report."""
802
809
  strategy_counts: dict[str, int] = {}
803
810
  blocked = []
804
811
  for domain, res in self._results.items():
@@ -1,3 +1,5 @@
1
+ """HIVE Event Bus — structured event emission, SSE streaming, and pipeline telemetry."""
2
+
1
3
  from __future__ import annotations
2
4
  import logging
3
5
  """
@@ -93,7 +95,8 @@ def ensure_events_table(db_path: str = DB_PATH) -> None:
93
95
  if col not in existing:
94
96
  con.execute(f"ALTER TABLE hive_missions ADD COLUMN IF NOT EXISTS {col} FLOAT DEFAULT NULL")
95
97
  con.commit()
96
- except Exception:
98
+ except Exception as e:
99
+ log.debug(f"Suppressed in events.py: {e}")
97
100
  pass # hive_missions may not exist yet — that's fine
98
101
 
99
102
  finally:
@@ -285,7 +288,7 @@ try:
285
288
  summary="Stream SSE events for a HIVE mission",
286
289
  response_class=StreamingResponse,
287
290
  )
288
- async def mission_events_sse(mission_id: str, since_id: int = 0):
291
+ async def mission_events_sse(mission_id: str, since_id: int = 0) -> object:
289
292
  """
290
293
  Server-Sent Events stream for a HIVE mission.
291
294
 
@@ -38,6 +38,7 @@ log = logging.getLogger(__name__)
38
38
  # ---------------------------------------------------------------------------
39
39
 
40
40
  class ThreatType:
41
+ """Enumeration of content injection threat categories."""
41
42
  PROMPT_INJECTION = "PROMPT_INJECTION" # klasyczna iniekcja instrukcji
42
43
  JAILBREAK = "JAILBREAK" # próba obejścia limitów
43
44
  INSTRUCTION_HIJACK = "INSTRUCTION_HIJACK" # "ignore previous instructions"
@@ -49,6 +50,7 @@ class ThreatType:
49
50
 
50
51
  @dataclass
51
52
  class GuardrailResult:
53
+ """Guardrail scan result: threat type, confidence, blocked flag."""
52
54
  blocked: bool
53
55
  threat_type: str = ThreatType.CLEAN
54
56
  score: float = 0.0 # 0.0 = no threat, 1.0 = certain attack
@@ -228,7 +230,8 @@ def _is_base64_malicious(b64_str: str) -> bool:
228
230
  # Check decoded content with Layer 1 patterns
229
231
  result = _layer1_pattern_scan(decoded)
230
232
  return result is not None
231
- except Exception:
233
+ except Exception as e:
234
+ log.debug(f"Suppressed in guardrail.py: {e}")
232
235
  return False
233
236
 
234
237
 
@@ -391,15 +394,18 @@ def scan_query(query: str) -> GuardrailResult:
391
394
 
392
395
  @dataclass
393
396
  class GuardrailStats:
397
+ """Aggregated guardrail statistics for a mission run."""
394
398
  total_scanned: int = 0
395
399
  total_blocked: int = 0
396
400
  by_threat: dict = field(default_factory=dict)
397
401
 
398
402
  @property
399
403
  def block_rate(self) -> float:
404
+ """Calculate the fraction of blocked requests."""
400
405
  return self.total_blocked / max(self.total_scanned, 1)
401
406
 
402
407
  def record(self, result: GuardrailResult) -> None:
408
+ """Record a guardrail check result."""
403
409
  self.total_scanned += 1
404
410
  if result.blocked:
405
411
  self.total_blocked += 1
@@ -257,7 +257,7 @@ def _get_fitz():
257
257
  _aiohttp_session = None
258
258
 
259
259
 
260
- async def get_session():
260
+ async def get_session() -> object:
261
261
  """Return the shared aiohttp.ClientSession, creating it if needed."""
262
262
  global _aiohttp_session
263
263
  if _aiohttp_session is None or _aiohttp_session.closed:
@@ -275,7 +275,7 @@ async def get_session():
275
275
  return _aiohttp_session
276
276
 
277
277
 
278
- async def close_session():
278
+ async def close_session() -> None:
279
279
  """Close and discard the shared aiohttp.ClientSession."""
280
280
  global _aiohttp_session
281
281
  if _aiohttp_session is not None and not _aiohttp_session.closed:
@@ -295,7 +295,8 @@ def _domain(url: str) -> str:
295
295
  try:
296
296
  host = urlparse(url).netloc.lower()
297
297
  return host.lstrip("www.")
298
- except Exception:
298
+ except Exception as e:
299
+ log.debug(f"Suppressed in harvest.py: {e}")
299
300
  return ""
300
301
 
301
302
 
@@ -304,7 +305,8 @@ def _ext(url: str) -> str:
304
305
  path = urlparse(url).path.lower()
305
306
  _, ext = os.path.splitext(path)
306
307
  return ext
307
- except Exception:
308
+ except Exception as e:
309
+ log.debug(f"Suppressed in harvest.py: {e}")
308
310
  return ""
309
311
 
310
312
 
@@ -327,7 +329,8 @@ def _get_drone_strategy(mission_id: str, domain: str) -> dict:
327
329
  try:
328
330
  from hive2_drones import get_strategy
329
331
  result = get_strategy(mission_id, domain)
330
- except Exception:
332
+ except Exception as e:
333
+ log.debug(f"Suppressed in harvest.py: {e}")
331
334
  result = {"strategy": "DIRECT", "working_ua": USER_AGENT,
332
335
  "delay_ms": 0, "via_jina": False, "via_wayback": False}
333
336
  _drone_strategy_cache[cache_key] = result
@@ -339,6 +342,7 @@ def _get_drone_strategy(mission_id: str, domain: str) -> dict:
339
342
  # ---------------------------------------------------------------------------
340
343
 
341
344
  class HarvesterBee:
345
+ """Content harvester — fetches, extracts, and scores web content."""
342
346
  def __init__(self, mission_id: str, workers: int = DEFAULT_WORKERS):
343
347
  self.mission_id = mission_id
344
348
  self.workers = workers
@@ -388,7 +392,8 @@ class HarvesterBee:
388
392
  # Main entry point
389
393
  # ------------------------------------------------------------------
390
394
 
391
- async def run(self):
395
+ async def run(self) -> dict:
396
+ """Execute the main pipeline loop."""
392
397
  log.info(f"HarvesterBee starting — mission={self.mission_id}, workers={self.workers}")
393
398
 
394
399
  sources = self._load_pending_sources()
@@ -1152,7 +1157,8 @@ class HarvesterBee:
1152
1157
  # Entry point
1153
1158
  # ---------------------------------------------------------------------------
1154
1159
 
1155
- def main():
1160
+ def main() -> None:
1161
+ """CLI entry point."""
1156
1162
  parser = argparse.ArgumentParser(
1157
1163
  description="HIVE 2.0 HarvesterBee — fetch content from hive_sources"
1158
1164
  )
@@ -1,3 +1,5 @@
1
+ """Pipeline orchestrator — Queen-first planning, phase coordination, and full research execution."""
2
+
1
3
  import logging
2
4
  #!/usr/bin/env python3
3
5
  """
@@ -1201,6 +1203,7 @@ def _get_unresolved_gaps(mission_id: str) -> list:
1201
1203
  # ---------------------------------------------------------------------------
1202
1204
 
1203
1205
  def new_mission_id(topic: str) -> str:
1206
+ """Generate a unique mission identifier."""
1204
1207
  h = hashlib.md5(topic.encode()).hexdigest()[:6]
1205
1208
  return f"hive_{int(time.time())}_{h}"
1206
1209
 
@@ -1327,7 +1330,7 @@ def _bar(phase: str, elapsed: float, width: int = 20) -> str:
1327
1330
  return f" {icon} {phase:<18} [{bar}] {elapsed:6.1f}s"
1328
1331
 
1329
1332
 
1330
- def cmd_run(topic: str, think: bool = False, deep: bool = False, force: bool = False, scale: int = 200):
1333
+ def cmd_run(topic: str, think: bool = False, deep: bool = False, force: bool = False, scale: int = 200) -> None:
1331
1334
  """Full pipeline with Queen-first planning: plan → scout → harvest → process → synth."""
1332
1335
  _init_db(None) # No-ops on PostgreSQL, creates tables on DuckDB legacy
1333
1336
 
@@ -1808,7 +1811,7 @@ Return JSON array of 5 strings only."""
1808
1811
  _emit(mission_id, 'done', 'done', data={'total_elapsed': total_elapsed, 'phases': list(timings.keys())})
1809
1812
 
1810
1813
 
1811
- def cmd_scout(topic: str):
1814
+ def cmd_scout(topic: str) -> None:
1812
1815
  """Scout only — Queen plans first, then runs hive2_scout.py."""
1813
1816
  # duckdb removed — PG is primary
1814
1817
  _init_db(None)
@@ -1841,7 +1844,7 @@ def cmd_scout(topic: str):
1841
1844
  log.debug(f'\n[HIVE] Mission ID do dalszego użycia: {mission_id}')
1842
1845
 
1843
1846
 
1844
- def cmd_plan(topic: str, output_file: str | None = None):
1847
+ def cmd_plan(topic: str, output_file: str | None = None) -> None:
1845
1848
  """
1846
1849
  Queen planning only — generate and print the scout task JSON.
1847
1850
  Useful for inspecting what the Queen would plan for a given topic.
@@ -1876,7 +1879,7 @@ def cmd_plan(topic: str, output_file: str | None = None):
1876
1879
  log.debug(json.dumps(plan, ensure_ascii=False, indent=2))
1877
1880
 
1878
1881
 
1879
- def cmd_harvest(mission_id: str):
1882
+ def cmd_harvest(mission_id: str) -> None:
1880
1883
  """Harvest existing mission."""
1881
1884
  # duckdb removed — PG is primary
1882
1885
  _init_db(None)
@@ -1889,7 +1892,7 @@ def cmd_harvest(mission_id: str):
1889
1892
  # ── P3.7: --resume — checkpoint-based recovery ────────────────────────────────
1890
1893
  _PHASE_ORDER = ['scout', 'harvest', 'process', 'synth', 'done']
1891
1894
 
1892
- def cmd_resume(mission_id: str):
1895
+ def cmd_resume(mission_id: str) -> None:
1893
1896
  """Resume mission from last completed phase (checkpoint)."""
1894
1897
  # duckdb removed — PG is primary
1895
1898
  _init_db(None)
@@ -1974,7 +1977,7 @@ def cmd_resume(mission_id: str):
1974
1977
  cmd_process(mission_id)
1975
1978
 
1976
1979
 
1977
- def cmd_process(mission_id: str):
1980
+ def cmd_process(mission_id: str) -> None:
1978
1981
  """Process existing mission."""
1979
1982
  # duckdb removed — PG is primary
1980
1983
  _init_db(None)
@@ -1994,7 +1997,7 @@ def cmd_process(mission_id: str):
1994
1997
  log.info(f"[HIVE] Falsifikacja failed ({e}) — raport już zapisany")
1995
1998
 
1996
1999
 
1997
- def cmd_synth(mission_id: str):
2000
+ def cmd_synth(mission_id: str) -> None:
1998
2001
  """Synthesize existing mission."""
1999
2002
  # duckdb removed — PG is primary
2000
2003
  _init_db(None)
@@ -1,3 +1,5 @@
1
+ """Content preprocessor — HTML cleaning, markdown extraction, and text normalization."""
2
+
1
3
  import logging
2
4
  #!/usr/bin/env python3
3
5
  """
@@ -123,6 +125,7 @@ def _generate_clarifications(topic: str) -> list[str]:
123
125
 
124
126
  @dataclass
125
127
  class PreprocessResult:
128
+ """Preprocessing result: cleaned text, metadata, quality signals."""
126
129
  ok: bool # True → proceed with refined_topic
127
130
  refined_topic: str # cleaned / unchanged topic
128
131
  specificity_score: float # 0.0–1.0
@@ -1,3 +1,5 @@
1
+ """PreScout routing — intelligent source triage, BeeMaster gate, and harvest prioritization."""
2
+
1
3
  from __future__ import annotations
2
4
  import logging
3
5
 
@@ -119,7 +121,8 @@ def classify_domain(url: str) -> dict:
119
121
  domain = parsed.netloc.lower().lstrip("www.")
120
122
  path = parsed.path.lower()
121
123
  url_l = url.lower()
122
- except Exception:
124
+ except Exception as e:
125
+ log.debug(f"Suppressed in prescout.py: {e}")
123
126
  return {"tier": "MEDIUM", "paywall": False, "api_likely": False, "spa_likely": False}
124
127
 
125
128
  # Tier
@@ -538,7 +541,8 @@ class PreScoutDancer:
538
541
  ).fetchone()
539
542
  con.close()
540
543
  self.topic = row[0] if row else ""
541
- except Exception:
544
+ except Exception as e:
545
+ log.debug(f"Suppressed in prescout.py: {e}")
542
546
  self.topic = ""
543
547
 
544
548
  def _get_sources(self) -> list[dict]:
@@ -751,7 +755,8 @@ class BeeMasterGate:
751
755
  if isinstance(raw_flags, str):
752
756
  try:
753
757
  flag_list = json.loads(raw_flags)
754
- except Exception:
758
+ except Exception as e:
759
+ log.debug(f"Suppressed in prescout.py: {e}")
755
760
  flag_list = []
756
761
  else:
757
762
  flag_list = list(raw_flags)
@@ -796,7 +801,8 @@ class BeeMasterGate:
796
801
  if isinstance(raw, str):
797
802
  try:
798
803
  flag_list = json.loads(raw)
799
- except Exception:
804
+ except Exception as e:
805
+ log.debug(f"Suppressed in prescout.py: {e}")
800
806
  flag_list = []
801
807
  else:
802
808
  flag_list = list(raw)
@@ -1093,7 +1099,8 @@ class TrueScout:
1093
1099
  "extraction_method": "pymupdf",
1094
1100
  "extraction_confidence": 0.9,
1095
1101
  }
1096
- except Exception:
1102
+ except Exception as e:
1103
+ log.debug(f"Suppressed in prescout.py: {e}")
1097
1104
  return {
1098
1105
  "data_volume_words": 1000,
1099
1106
  "pdf_pages": None,
@@ -1157,7 +1164,8 @@ class TrueScout:
1157
1164
  "extraction_method": "rss_bee",
1158
1165
  "extraction_confidence": 0.9,
1159
1166
  }
1160
- except Exception:
1167
+ except Exception as e:
1168
+ log.debug(f"Suppressed in prescout.py: {e}")
1161
1169
  return {
1162
1170
  "data_volume_words": 300,
1163
1171
  "content_preview": "RSS",
@@ -1,3 +1,5 @@
1
+ """Claim processing — extraction, deduplication, quality scoring, and DB persistence."""
2
+
1
3
  from typing import Any
2
4
  #!/usr/bin/env python3
3
5
  """
@@ -198,7 +200,8 @@ def _new_id() -> str:
198
200
  def _domain(url: str) -> str:
199
201
  try:
200
202
  return urlparse(url).netloc.lower().lstrip("www.")
201
- except Exception:
203
+ except Exception as e:
204
+ log.debug(f"Suppressed in process.py: {e}")
202
205
  return ""
203
206
 
204
207
 
@@ -254,6 +257,7 @@ class SGLangClient:
254
257
  model: Optional[str] = None,
255
258
  max_tokens: int = 1024,
256
259
  ) -> str:
260
+ """Invoke a single bee operation on content."""
257
261
  messages = []
258
262
  if system_prompt:
259
263
  messages.append({"role": "system", "content": system_prompt})
@@ -303,7 +307,8 @@ class SGLangClient:
303
307
  url = SGLANG_URL.replace("/v1/chat/completions", "/health")
304
308
  with _urllib_request.urlopen(url, timeout=2) as r:
305
309
  self._available = r.status == 200
306
- except Exception:
310
+ except Exception as e:
311
+ log.debug(f"Suppressed in process.py: {e}")
307
312
  self._available = False
308
313
  self._last_check = _t.time()
309
314
  return self._available
@@ -325,6 +330,7 @@ class _BedrockFallbackClient:
325
330
  self._client = _boto3.client("bedrock-runtime", region_name=BEDROCK_REGION)
326
331
  return self._client
327
332
  def invoke(self, prompt: str, system_prompt: str = None, model: str = None, max_tokens: int = 512) -> str:
333
+ """Invoke a single bee operation on content."""
328
334
  m = model or MODEL_FAST_PRIMARY
329
335
  sp = system_prompt or "You are a precise data extraction AI. Return only valid JSON."
330
336
  body = _json_b.dumps({
@@ -515,7 +521,8 @@ class RelevanceFilter:
515
521
  scores = json.loads(m.group(0))
516
522
  if len(scores) == len(docs):
517
523
  return [max(0.0, min(1.0, float(s))) for s in scores]
518
- except Exception:
524
+ except Exception as e:
525
+ log.debug(f"Suppressed in process.py: {e}")
519
526
  # Bedrock fallback
520
527
  try:
521
528
  text = await _bedrock_invoke_async(prompt, max_tokens=200)
@@ -739,7 +746,8 @@ class OperationRouter:
739
746
  if fitness:
740
747
  log.info(f" 📊 Feedback fitness loaded: {len(fitness)} ops rated")
741
748
  return fitness
742
- except Exception:
749
+ except Exception as e:
750
+ log.debug(f"Suppressed in process.py: {e}")
743
751
  return {}
744
752
 
745
753
  def route(self, doc: dict) -> list["BeeOperation"]:
@@ -1313,6 +1321,7 @@ class DeduplicationDrone:
1313
1321
  """Merges near-duplicate entities using rapidfuzz."""
1314
1322
 
1315
1323
  def run(self, con: Any, mission_id: str) -> int:
1324
+ """Execute the main pipeline loop."""
1316
1325
  if not _rapidfuzz_available:
1317
1326
  log.warning("DeduplicationDrone: rapidfuzz not available, skipping")
1318
1327
  return 0
@@ -1372,6 +1381,7 @@ class FactValidationDrone:
1372
1381
  """Cross-domain confidence scoring for numeric facts."""
1373
1382
 
1374
1383
  def run(self, con: Any, mission_id: str) -> int:
1384
+ """Execute the main pipeline loop."""
1375
1385
  try:
1376
1386
  rows = con.execute("""
1377
1387
  SELECT id, value, unit, sources
@@ -1394,7 +1404,8 @@ class FactValidationDrone:
1394
1404
  continue
1395
1405
  try:
1396
1406
  srcs = json.loads(sources_json) if sources_json else []
1397
- except Exception:
1407
+ except Exception as e:
1408
+ log.debug(f"Suppressed in process.py: {e}")
1398
1409
  srcs = []
1399
1410
  for src in srcs:
1400
1411
  vud[(round(float(value), 4), unit)].add(_domain(str(src)))
@@ -1456,9 +1467,11 @@ class ClaimCrossValidationDrone:
1456
1467
 
1457
1468
  def run(self, con: Any, mission_id: str) -> int:
1458
1469
  # Dodaj evidence_flags if not istnieje
1470
+ """Execute the main pipeline loop."""
1459
1471
  try:
1460
1472
  con.execute("ALTER TABLE hive_claims ADD COLUMN IF NOT EXISTS evidence_flags VARCHAR")
1461
- except Exception:
1473
+ except Exception as e:
1474
+ log.debug(f"Suppressed in process.py: {e}")
1462
1475
  pass # może not wspierać IF NOT EXISTS — ignoruj
1463
1476
 
1464
1477
  try:
@@ -1487,7 +1500,8 @@ class ClaimCrossValidationDrone:
1487
1500
  try:
1488
1501
  from urllib.parse import urlparse
1489
1502
  return urlparse(str(url)).netloc.lower().lstrip("www.")
1490
- except Exception:
1503
+ except Exception as e:
1504
+ log.debug(f"Suppressed in process.py: {e}")
1491
1505
  return str(url)[:40]
1492
1506
 
1493
1507
  # Buduj indeks: claim_id → (claim_text, domain, confidence)
@@ -1540,6 +1554,7 @@ class GapDrone:
1540
1554
  """Generates research gap analysis using Bedrock."""
1541
1555
 
1542
1556
  def run(self, con: Any, mission_id: str, topic: str) -> list[dict]:
1557
+ """Execute the main pipeline loop."""
1543
1558
  if not _boto3_available:
1544
1559
  log.warning("GapDrone: boto3 not available, skipping")
1545
1560
  return []
@@ -1552,7 +1567,8 @@ class GapDrone:
1552
1567
  GROUP BY value, entity_type
1553
1568
  ORDER BY cnt DESC LIMIT 20
1554
1569
  """, [mission_id]).fetchall()
1555
- except Exception:
1570
+ except Exception as e:
1571
+ log.debug(f"Suppressed in process.py: {e}")
1556
1572
  entity_rows = []
1557
1573
 
1558
1574
  try:
@@ -1563,7 +1579,8 @@ class GapDrone:
1563
1579
  ORDER BY confidence DESC
1564
1580
  LIMIT 10
1565
1581
  """, [mission_id]).fetchall()
1566
- except Exception:
1582
+ except Exception as e:
1583
+ log.debug(f"Suppressed in process.py: {e}")
1567
1584
  fact_rows = []
1568
1585
 
1569
1586
  top_entities = ", ".join(f"{r[0]} ({r[1]})" for r in entity_rows) or "none"
@@ -1668,7 +1685,7 @@ class ProcessingDrones:
1668
1685
  except Exception as exc:
1669
1686
  log.warning(f"Schema ensure error: {exc}")
1670
1687
 
1671
- def run(self):
1688
+ def run(self) -> dict:
1672
1689
  """Synchronous entry point — wraps the async pipeline."""
1673
1690
  asyncio.run(self._run_async())
1674
1691
 
@@ -2126,7 +2143,8 @@ class ProcessingDrones:
2126
2143
  [self.mission_id]
2127
2144
  ).fetchone()
2128
2145
  return row[0] if row else "Unknown topic"
2129
- except Exception:
2146
+ except Exception as e:
2147
+ log.debug(f"Suppressed in process.py: {e}")
2130
2148
  return "Unknown topic"
2131
2149
 
2132
2150
  def _finalize(
@@ -2220,7 +2238,8 @@ class ProcessingDrones:
2220
2238
  # Entry point
2221
2239
  # ---------------------------------------------------------------------------
2222
2240
 
2223
- def main():
2241
+ def main() -> None:
2242
+ """CLI entry point."""
2224
2243
  parser = argparse.ArgumentParser(
2225
2244
  description="HIVE 3.0 BPMN ProcessingDrones — transform raw content into intelligence"
2226
2245
  )
@@ -1,3 +1,5 @@
1
+ """Quality scoring — multi-signal content evaluation, relevance filtering, and metrics."""
2
+
1
3
  from __future__ import annotations
2
4
  import logging
3
5
 
@@ -77,6 +77,7 @@ TOPIC_DOMAIN_KEYWORDS: dict[str, list[str]] = {
77
77
 
78
78
  @dataclass
79
79
  class SourceProfile:
80
+ """Source quality profile — aggregated trust signals for a domain."""
80
81
  source_type: str
81
82
  avg_score: float
82
83
  avg_authority: float
@@ -84,8 +85,8 @@ class SourceProfile:
84
85
  recommendation: str = ""
85
86
 
86
87
 
87
- @dataclass
88
88
  class OperationProfile:
89
+ """Bee operation profile — success rates and timing statistics."""
89
90
  operation_name: str
90
91
  tier: int
91
92
  avg_confidence: float
@@ -132,6 +133,7 @@ class CalibrationProfile:
132
133
  mission_stats: dict = field(default_factory=dict)
133
134
 
134
135
  def summary(self) -> str:
136
+ """Return human-readable summary of the quorum result."""
135
137
  lines = [
136
138
  f"CalibrationProfile(domain={self.topic_domain}, generated={self.generated_at.isoformat()})",
137
139
  f" sources: {len(self.source_profiles)} types | blocked: {len(self.blocked_domains)} | cf: {len(self.cloudflare_domains)}",
@@ -335,7 +337,8 @@ class QueenCalibrator:
335
337
  blocked = [r[0] for r in rows if r[2] == "SKIP"]
336
338
  cloudflare = [r[0] for r in rows if r[1] == "cloudflare"]
337
339
  return blocked, cloudflare
338
- except Exception:
340
+ except Exception as e:
341
+ log.debug(f"Suppressed in queen_calibrator.py: {e}")
339
342
  return [], [] # drone_map nie istnieje lub pusta — ignoruj
340
343
 
341
344
  def _analyze_operations(
@@ -170,6 +170,7 @@ def _haiku(prompt: str, max_tokens: int = 600) -> Optional[str]:
170
170
 
171
171
  @dataclass
172
172
  class FactRecord:
173
+ """Persistent fact record with embedding, confidence, and provenance."""
173
174
  id: str
174
175
  fact_text: str
175
176
  source_type: str
@@ -532,6 +533,7 @@ class QueenFactMemory:
532
533
  # Stats
533
534
  # ------------------------------------------------------------------
534
535
 
536
+ """Return memory statistics: total facts, coverage, staleness."""
535
537
  def stats(self) -> dict:
536
538
  con = self._get_con()
537
539
  row = con.execute(
@@ -549,6 +551,7 @@ class QueenFactMemory:
549
551
  }
550
552
 
551
553
  def close(self) -> None:
554
+ """Close the database connection."""
552
555
  if self._con:
553
556
  self._con.close()
554
557
  self._con = None
@@ -1,3 +1,5 @@
1
+ """Queen Memory — cross-mission knowledge persistence and operational context injection."""
2
+
1
3
  import logging
2
4
  #!/usr/bin/env python3
3
5
  """
@@ -66,6 +66,7 @@ _MIN_KEYWORD_OVERLAP = 0.25 # 25% shared keywords → "related topic"
66
66
 
67
67
  @dataclass
68
68
  class Primer:
69
+ """Mission primer — context from similar past missions for Queen planning."""
69
70
  mission_id: str
70
71
  topic: str
71
72
  top_domains: List[str] = field(default_factory=list)
@@ -148,7 +149,7 @@ class QueenPrimer:
148
149
  topic: str,
149
150
  synthesis_text: str = "",
150
151
  quality_score: float = 0.5,
151
- ):
152
+ ) -> None:
152
153
  """
153
154
  Builds and saves primer from current mission's DB data.
154
155
  Wywołaj na końcu syntezy.
@@ -1,3 +1,5 @@
1
+ """Scout module — query generation, source discovery, RSS/DDG/API routing, and URL scoring."""
2
+
1
3
  import logging
2
4
  #!/usr/bin/env python3
3
5
  """
@@ -607,7 +609,8 @@ class SwarmScout:
607
609
  "UPDATE hive_missions SET sources_found=?, status='harvest' WHERE id=?",
608
610
  [self._total_saved, self.mission_id],
609
611
  )
610
- except Exception:
612
+ except Exception as e:
613
+ log.debug(f"Suppressed in scout.py: {e}")
611
614
  try:
612
615
  self.db.execute(
613
616
  "UPDATE hive_missions SET sources_found=?, phase='harvest' WHERE id=?",
@@ -701,7 +704,8 @@ def generate_standalone_plan(topic: str) -> list[dict]:
701
704
  # Entry point
702
705
  # ──────────────────────────────────────────────────────────────────────────────
703
706
 
704
- def main():
707
+ def main() -> None:
708
+ """CLI entry point."""
705
709
  args = sys.argv[1:]
706
710
 
707
711
  if len(args) < 2:
@@ -250,6 +250,7 @@ Return the complete final report in Markdown.""", max_tokens=4096)
250
250
  # ---------------------------------------------------------------------------
251
251
 
252
252
  class Queen:
253
+ """Queen synthesizer — multi-pass evidence hierarchy, narrative generation, and PDF output."""
253
254
  def __init__(self, mission_id: str):
254
255
  self.mission_id = mission_id
255
256
  self._import_duckdb()
@@ -265,7 +266,8 @@ class Queen:
265
266
  try:
266
267
  pass # duckdb removed
267
268
  self.duckdb = None
268
- except Exception:
269
+ except Exception as e:
270
+ log.debug(f"Suppressed in synth.py: {e}")
269
271
  self.duckdb = None # Not fatal — PostgreSQL is primary
270
272
 
271
273
  # ── DuckDB connection helper ──────────────────────────────────────────────
@@ -313,12 +315,11 @@ class Queen:
313
315
  "total_facts": mr[7], "created_at": str(mr[8]),
314
316
  }
315
317
 
316
- all_tables = {row[0] for row in con.execute("SHOW TABLES").fetchall()}
317
-
318
- def safe_query(sql, params=None):
318
+ def safe_query(sql, params=None) -> list:
319
319
  try:
320
320
  return con.execute(sql, params or [mid]).fetchall()
321
- except Exception:
321
+ except Exception as e:
322
+ log.debug(f"Suppressed in synth.py: {e}")
322
323
  return []
323
324
 
324
325
  # ── Core mission honey ────────────────────────────────────────────
@@ -378,7 +379,8 @@ class Queen:
378
379
  _cm2 = _clu2.module_from_spec(_cs2)
379
380
  _cs2.loader.exec_module(_cm2)
380
381
  cluster_context_block = _cm2.build_cluster_context(self.mission_id)
381
- except Exception:
382
+ except Exception as e:
383
+ log.debug(f"Suppressed in synth.py: {e}")
382
384
  cluster_context_block = None
383
385
  clusters_raw = safe_query(
384
386
  """SELECT cluster_id, topic_label, keywords,
@@ -532,7 +534,8 @@ class Queen:
532
534
  conf = rc[4]
533
535
  try:
534
536
  conf_f = float(conf)
535
- except Exception:
537
+ except Exception as e:
538
+ log.debug(f"Suppressed in synth.py: {e}")
536
539
  conf_f = 0.5
537
540
  if conf_f < 0.65:
538
541
  continue
@@ -567,7 +570,8 @@ class Queen:
567
570
  seen_claims.add(dedup_key)
568
571
  try:
569
572
  conf_val = f"{float(conf):.2f}"
570
- except Exception:
573
+ except Exception as e:
574
+ log.debug(f"Suppressed in synth.py: {e}")
571
575
  conf_val = str(conf)
572
576
  domain = ""
573
577
  if src_url:
@@ -625,7 +629,8 @@ class Queen:
625
629
  conf = rc[4]
626
630
  try:
627
631
  conf_f = float(conf)
628
- except Exception:
632
+ except Exception as e:
633
+ log.debug(f"Suppressed in synth.py: {e}")
629
634
  conf_f = 0.5
630
635
  if conf_f < 0.6:
631
636
  continue
@@ -634,7 +639,8 @@ class Queen:
634
639
  try:
635
640
  from urllib.parse import urlparse as _up
636
641
  domain = _up(src_url).netloc.replace("www.", "")
637
- except Exception:
642
+ except Exception as e:
643
+ log.debug(f"Suppressed in synth.py: {e}")
638
644
  domain = src_url[:40]
639
645
  for val_str, unit_str in matches[:2]:
640
646
  lines.append(
@@ -745,7 +751,8 @@ class Queen:
745
751
  cv_mark = " ✓" if cross_val else ""
746
752
  try:
747
753
  conf_val = f"{float(conf):.2f}"
748
- except Exception:
754
+ except Exception as e:
755
+ log.debug(f"Suppressed in synth.py: {e}")
749
756
  conf_val = str(conf)
750
757
  lines.append(
751
758
  f"• {claim} [{domain}, {year}]{cv_mark} "
@@ -796,7 +803,8 @@ class Queen:
796
803
  seen_claims.add(dedup_key)
797
804
  try:
798
805
  conf_val = f"{float(conf):.2f}"
799
- except Exception:
806
+ except Exception as e:
807
+ log.debug(f"Suppressed in synth.py: {e}")
800
808
  conf_val = str(conf)
801
809
  domain = ""
802
810
  if src_url:
@@ -826,7 +834,8 @@ class Queen:
826
834
  op_id, op_name, tier, conf, output_json_raw, bee_mission = row
827
835
  try:
828
836
  oj = json.loads(output_json_raw) if output_json_raw else {}
829
- except Exception:
837
+ except Exception as e:
838
+ log.debug(f"Suppressed in synth.py: {e}")
830
839
  oj = {}
831
840
 
832
841
  # Extract hypotheses from various output_json shapes
@@ -853,7 +862,8 @@ class Queen:
853
862
  continue
854
863
  try:
855
864
  prob_val = f"P={float(prob):.2f}"
856
- except Exception:
865
+ except Exception as e:
866
+ log.debug(f"Suppressed in synth.py: {e}")
857
867
  prob_val = f"P=?"
858
868
  lines.append(
859
869
  f"{prob_val} — {str(hyp_text)[:200]} "
@@ -877,7 +887,8 @@ class Queen:
877
887
  fact, domain, confidence, times_confirmed, times_contradicted = row
878
888
  try:
879
889
  conf_val = f"{float(confidence):.2f}"
880
- except Exception:
890
+ except Exception as e:
891
+ log.debug(f"Suppressed in synth.py: {e}")
881
892
  conf_val = str(confidence)
882
893
  contra_note = (
883
894
  f" ⚠️ CONTRADICTED {times_contradicted}×"
@@ -898,7 +909,8 @@ class Queen:
898
909
  hypothesis, topic_domain, failure_reason, conf_at_death = row
899
910
  try:
900
911
  conf_val = f"{float(conf_at_death):.2f}"
901
- except Exception:
912
+ except Exception as e:
913
+ log.debug(f"Suppressed in synth.py: {e}")
902
914
  conf_val = "?"
903
915
  lines.append(
904
916
  f"✗ [{topic_domain or '?'}] {hypothesis} "
@@ -1084,11 +1096,15 @@ Dla każdego twierdzenia odpowiedz:
1084
1096
  if len(rc) >= 5:
1085
1097
  claim_txt, _ev, src, ct, conf = str(rc[0] or "")[:300], rc[1], str(rc[2] or ""), str(rc[3] or "general"), 0.7
1086
1098
  try: conf = float(rc[4])
1087
- except Exception: conf = 0.7
1099
+ except Exception as e:
1100
+ log.debug(f"Suppressed in synth.py: {e}")
1101
+ conf = 0.7
1088
1102
  elif len(rc) >= 3:
1089
1103
  claim_txt, src, ct, conf = str(rc[0] or "")[:300], str(rc[1] or ""), "general", 0.7
1090
1104
  try: conf = float(rc[2])
1091
- except Exception: conf = 0.7
1105
+ except Exception as e:
1106
+ log.debug(f"Suppressed in synth.py: {e}")
1107
+ conf = 0.7
1092
1108
  else:
1093
1109
  continue
1094
1110
  ct = str(ct or "general").lower()
@@ -1436,7 +1452,8 @@ Każda pozycja na osobnej linii. Poprzedź je linią nagłówkową: "=FUIR_START
1436
1452
  conf_raw = synthesis.get("confidence_raw", 0.0)
1437
1453
  try:
1438
1454
  conf_str = f"{float(conf_raw):.2f}"
1439
- except Exception:
1455
+ except Exception as e:
1456
+ log.debug(f"Suppressed in synth.py: {e}")
1440
1457
  conf_str = "?"
1441
1458
 
1442
1459
  report = f"""# HIVE 2.0 — Intelligence Brief (Queen 3.0)
@@ -1539,7 +1556,7 @@ Słowa: {m['total_words']} | Encje: {m['total_entities']} | Fakty: {m['total_fac
1539
1556
  table_buf = []
1540
1557
  flush_needed = False
1541
1558
 
1542
- def flush_table(buf):
1559
+ def flush_table(buf) -> None:
1543
1560
  if not buf:
1544
1561
  return
1545
1562
  # Odfiltruj separator (|---|---|)
@@ -1774,7 +1791,8 @@ Słowa: {m['total_words']} | Encje: {m['total_entities']} | Fakty: {m['total_fac
1774
1791
  pred_conf = pred.get("pred_conf") or conf_raw
1775
1792
  try:
1776
1793
  pred_conf = float(pred_conf)
1777
- except Exception:
1794
+ except Exception as e:
1795
+ log.debug(f"Suppressed in synth.py: {e}")
1778
1796
  pred_conf = 0.5
1779
1797
 
1780
1798
  con.execute("""
@@ -1872,7 +1890,8 @@ Słowa: {m['total_words']} | Encje: {m['total_entities']} | Fakty: {m['total_fac
1872
1890
 
1873
1891
  # ── Main entry point ─────────────────────────────────────────────────────
1874
1892
 
1875
- def run(self):
1893
+ def run(self) -> dict:
1894
+ """Execute the main pipeline loop."""
1876
1895
  t0 = time.time()
1877
1896
  log.debug(f"\n👑 QUEEN 3.0 — synteza misji: {self.mission_id}")
1878
1897
  log.info("[QUEEN] Pipeline: Evidence Hierarchy → Falsification → "
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: behive
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Research engine that builds structured knowledge graphs from any topic
5
5
  Author-email: QA10 <hello@qa10.io>
6
6
  License-Expression: MIT
@@ -18,7 +18,7 @@ def test_import_behive():
18
18
  """behive package imports without error."""
19
19
  import behive
20
20
  assert hasattr(behive, "__version__")
21
- assert behive.__version__ == "0.2.0"
21
+ assert behive.__version__ == "0.2.2"
22
22
 
23
23
 
24
24
  def test_import_client():
@@ -78,7 +78,7 @@ def test_cli_version():
78
78
  timeout=10,
79
79
  )
80
80
  assert result.returncode == 0
81
- assert "0.2.0" in result.stdout
81
+ assert "0.2.2" in result.stdout
82
82
 
83
83
 
84
84
  def test_cli_help():
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes