@oswaldzsh/devhive 0.1.0

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 (46) hide show
  1. package/README.md +91 -0
  2. package/__init__.py +0 -0
  3. package/agents/__init__.py +0 -0
  4. package/agents/base.py +118 -0
  5. package/agents/execute.py +150 -0
  6. package/agents/verifier_dynamic.py +164 -0
  7. package/agents/verifier_semantic.py +84 -0
  8. package/agents/verifier_static.py +153 -0
  9. package/bin/dh +77 -0
  10. package/config.yaml +71 -0
  11. package/control_plane/__init__.py +0 -0
  12. package/control_plane/cli.py +596 -0
  13. package/control_plane/dashboard.py +57 -0
  14. package/control_plane/notifications.py +54 -0
  15. package/control_plane/tui.py +352 -0
  16. package/install.sh +67 -0
  17. package/orchestrator/__init__.py +0 -0
  18. package/orchestrator/agent_pool.py +107 -0
  19. package/orchestrator/convergence_gate.py +133 -0
  20. package/orchestrator/engine.py +353 -0
  21. package/orchestrator/event_bus.py +58 -0
  22. package/orchestrator/task_queue.py +59 -0
  23. package/package.json +50 -0
  24. package/protocol/__init__.py +0 -0
  25. package/protocol/schemas.py +222 -0
  26. package/setup.py +44 -0
  27. package/signature/__init__.py +0 -0
  28. package/signature/engine.py +211 -0
  29. package/signature/extractor.py +156 -0
  30. package/signature/learner.py +75 -0
  31. package/signature/src/matcher.c +263 -0
  32. package/signature/src/matcher.h +135 -0
  33. package/signatures/seed_signatures.json +174 -0
  34. package/storage/__init__.py +0 -0
  35. package/storage/checkpoint.py +153 -0
  36. package/storage/signature_db.py +62 -0
  37. package/tools/__init__.py +0 -0
  38. package/tools/api_client.py +101 -0
  39. package/tools/git.py +75 -0
  40. package/tools/sandbox.py +79 -0
  41. package/verification/__init__.py +0 -0
  42. package/verification/diagnostic.py +124 -0
  43. package/verification/patterns/api_breaking.yaml +25 -0
  44. package/verification/patterns/code_quality.yaml +41 -0
  45. package/verification/patterns/security.yaml +41 -0
  46. package/verification/pipeline.py +61 -0
@@ -0,0 +1,41 @@
1
+ # Security-related detection rules
2
+ patterns:
3
+ - id: S001
4
+ name: new_network_call_no_timeout
5
+ desc: "New network request added without timeout or deadline context"
6
+ severity: HIGH
7
+ detector:
8
+ type: ast_pattern
9
+ rule: "new http/client call AND no timeout/deadline context"
10
+
11
+ - id: S002
12
+ name: sql_injection_risk
13
+ desc: "String formatting or concatenation used in SQL query construction"
14
+ severity: CRITICAL
15
+ detector:
16
+ type: ast_pattern
17
+ rule: "SQL string built with f-string or .format() instead of parameterized query"
18
+
19
+ - id: S003
20
+ name: hardcoded_secret
21
+ desc: "Potential hardcoded credential, API key, or token"
22
+ severity: CRITICAL
23
+ detector:
24
+ type: pattern_match
25
+ rule: "string literal matching secret/key/token/password patterns"
26
+
27
+ - id: S004
28
+ name: missing_auth_check
29
+ desc: "New endpoint or handler added without authentication decorator"
30
+ severity: HIGH
31
+ detector:
32
+ type: ast_pattern
33
+ rule: "new route/endpoint handler without auth middleware"
34
+
35
+ - id: S005
36
+ name: unsafe_deserialization
37
+ desc: "Use of pickle, yaml.load, or eval on user-controlled input"
38
+ severity: CRITICAL
39
+ detector:
40
+ type: ast_pattern
41
+ rule: "pickle.loads|yaml.load|eval|exec with variable input"
@@ -0,0 +1,61 @@
1
+ """Verification Pipeline — orchestrates L1/L2 verification stages."""
2
+
3
+ import asyncio
4
+ from typing import Optional
5
+
6
+ from protocol.schemas import (
7
+ Task, ExecutionHandoff, Verdict, SemanticVerdict,
8
+ VerdictOverall, ConcurrencyAction,
9
+ )
10
+ from agents.verifier_static import StaticVerifier
11
+ from agents.verifier_dynamic import DynamicVerifier
12
+ from agents.verifier_semantic import SemanticVerifier
13
+
14
+
15
+ class VerificationPipeline:
16
+ """Runs Static + Dynamic in parallel (L1), Semantic on demand (L2)."""
17
+
18
+ def __init__(self, config: dict = None):
19
+ self.config = config or {}
20
+
21
+ async def run_l1(self, task: Task) -> tuple[Verdict, Verdict]:
22
+ """Run Static and Dynamic verification in parallel."""
23
+ static_config = self.config.get("static_verifier", {})
24
+ dynamic_config = self.config.get("dynamic_verifier", {})
25
+
26
+ # In production, these would run as separate processes.
27
+ # For the MVP, we run them sequentially in-process.
28
+ static_verdict = await self._run_static(task)
29
+ dynamic_verdict = await self._run_dynamic(task)
30
+
31
+ return static_verdict, dynamic_verdict
32
+
33
+ async def _run_static(self, task: Task) -> Verdict:
34
+ """Run static verification."""
35
+ from agents.verifier_static import StaticVerifier
36
+ # Direct call for MVP; in production this dispatches to a process
37
+ verifier = StaticVerifier("static-v", None, None, self.config)
38
+ return verifier._execute(task)
39
+
40
+ async def _run_dynamic(self, task: Task) -> Verdict:
41
+ """Run dynamic verification."""
42
+ from agents.verifier_dynamic import DynamicVerifier
43
+ verifier = DynamicVerifier("dynamic-v", None, None, self.config)
44
+ return verifier._execute(task)
45
+
46
+ async def run_l2(self, task: Task) -> SemanticVerdict:
47
+ """Run semantic verification (more expensive, merge-gate only)."""
48
+ from agents.verifier_semantic import SemanticVerifier
49
+ verifier = SemanticVerifier("semantic-v", None, None, self.config)
50
+ return verifier._execute(task)
51
+
52
+ async def run_mutation(self, task: Task) -> Verdict:
53
+ """Run mutation testing to detect coverage gaps."""
54
+ # MVP: placeholder for mutation testing
55
+ from protocol.schemas import Verdict, VerdictOverall, VerifierType
56
+ return Verdict(
57
+ verifier_type=VerifierType.DYNAMIC,
58
+ task_id=task.id,
59
+ overall=VerdictOverall.PASS,
60
+ findings=[],
61
+ )