cluxion-agentplugin-preprocessing 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.
Files changed (48) hide show
  1. cluxion_agentplugin_adapters/claude/.claude-plugin/plugin.json +8 -0
  2. cluxion_agentplugin_adapters/claude/skills/preprocess/SKILL.md +33 -0
  3. cluxion_agentplugin_adapters/codex/config-snippet.toml +5 -0
  4. cluxion_agentplugin_docs/cluxion-Docs/README.md +22 -0
  5. cluxion_agentplugin_docs/cluxion-Docs/architecture.md +36 -0
  6. cluxion_agentplugin_docs/cluxion-Docs/harness-logic.md +51 -0
  7. cluxion_agentplugin_docs/cluxion-Docs/honesty-preprocessing.md +40 -0
  8. cluxion_agentplugin_docs/cluxion-Docs/install-and-operations.md +36 -0
  9. cluxion_agentplugin_docs/cluxion-Docs/security.md +27 -0
  10. cluxion_agentplugin_docs/github-profile/README.md +67 -0
  11. cluxion_agentplugin_preprocessing/__init__.py +7 -0
  12. cluxion_agentplugin_preprocessing/cli.py +124 -0
  13. cluxion_agentplugin_preprocessing/hermes_config.py +163 -0
  14. cluxion_agentplugin_preprocessing/plugin.py +135 -0
  15. cluxion_agentplugin_preprocessing/plugin.yaml +13 -0
  16. cluxion_agentplugin_preprocessing/runner.py +241 -0
  17. cluxion_agentplugin_preprocessing/schemas.py +148 -0
  18. cluxion_agentplugin_preprocessing-0.2.0.dist-info/METADATA +115 -0
  19. cluxion_agentplugin_preprocessing-0.2.0.dist-info/RECORD +48 -0
  20. cluxion_agentplugin_preprocessing-0.2.0.dist-info/WHEEL +4 -0
  21. cluxion_agentplugin_preprocessing-0.2.0.dist-info/entry_points.txt +8 -0
  22. cluxion_agentplugin_preprocessing-0.2.0.dist-info/licenses/LICENSE +197 -0
  23. cluxion_runtime/__init__.py +16 -0
  24. cluxion_runtime/__main__.py +5 -0
  25. cluxion_runtime/adapters/__init__.py +25 -0
  26. cluxion_runtime/adapters/contract.py +82 -0
  27. cluxion_runtime/adapters/grok_build.py +35 -0
  28. cluxion_runtime/adapters/hermes.py +161 -0
  29. cluxion_runtime/adapters/spec.py +35 -0
  30. cluxion_runtime/bootstrap.py +270 -0
  31. cluxion_runtime/cli.py +282 -0
  32. cluxion_runtime/core/__init__.py +36 -0
  33. cluxion_runtime/core/clarification.py +192 -0
  34. cluxion_runtime/core/dispatch_store.py +270 -0
  35. cluxion_runtime/core/harness.py +320 -0
  36. cluxion_runtime/core/intent.py +55 -0
  37. cluxion_runtime/core/ledger.py +189 -0
  38. cluxion_runtime/core/ledger_codec.py +38 -0
  39. cluxion_runtime/core/plan_codec.py +121 -0
  40. cluxion_runtime/core/preprocess.py +497 -0
  41. cluxion_runtime/core/types.py +220 -0
  42. cluxion_runtime/core/work_queue.py +73 -0
  43. cluxion_runtime/models/__init__.py +15 -0
  44. cluxion_runtime/models/supervisor.py +156 -0
  45. cluxion_runtime/models/vllm_mlx.py +87 -0
  46. cluxion_runtime/resources/__init__.py +7 -0
  47. cluxion_runtime/resources/queue_bridge.py +128 -0
  48. cluxion_runtime/resources/rust_bridge.py +82 -0
@@ -0,0 +1,82 @@
1
+ from __future__ import annotations
2
+
3
+ """Conservative resource monitor and admission policy."""
4
+
5
+ import psutil
6
+
7
+ from cluxion_runtime.core.types import ResourceDecision, ResourceSnapshot
8
+
9
+
10
+ def collect_resource_snapshot() -> ResourceSnapshot:
11
+ """Collect a resource snapshot without importing legacy Cluxion OS modules."""
12
+ memory = psutil.virtual_memory()
13
+ swap = psutil.swap_memory()
14
+ return ResourceSnapshot(
15
+ total_ram_mb=int(memory.total // 1_048_576),
16
+ available_ram_mb=int(memory.available // 1_048_576),
17
+ swap_used_mb=int(swap.used // 1_048_576),
18
+ cpu_percent=float(psutil.cpu_percent(interval=None)),
19
+ )
20
+
21
+
22
+ def evaluate_pressure(
23
+ snapshot: ResourceSnapshot,
24
+ *,
25
+ active_agents: int = 0,
26
+ requested_parallel: int = 1,
27
+ ) -> ResourceDecision:
28
+ """Return a pressure decision from bounded local resource data."""
29
+ _ = active_agents
30
+ return _fallback_pressure(snapshot, requested_parallel)
31
+
32
+
33
+ def capacity_decision(
34
+ work_kind: str,
35
+ snapshot: ResourceSnapshot,
36
+ *,
37
+ expected_ram_mb: int = 0,
38
+ user_mode: str = "balanced",
39
+ network_quality: str = "good",
40
+ active_codex: int = 0,
41
+ active_grok: int = 0,
42
+ active_claude: int = 0,
43
+ active_browser: int = 0,
44
+ active_tests: int = 0,
45
+ active_generic: int = 0,
46
+ active_qwen_sessions: int = 0,
47
+ qwen_session_limit: int = 1,
48
+ ) -> ResourceDecision:
49
+ """Compute a fail-closed capacity envelope for work dispatch."""
50
+ pressure = evaluate_pressure(snapshot)
51
+ if not pressure.allowed:
52
+ return ResourceDecision(**{**pressure.__dict__, "work_kind": work_kind})
53
+ _ = (user_mode, network_quality, active_codex, active_grok, active_claude, active_browser, active_tests, active_qwen_sessions, qwen_session_limit)
54
+ required = max(1, expected_ram_mb)
55
+ if snapshot.available_ram_mb < required:
56
+ return ResourceDecision(False, "deferred", "memory_budget_low", 0, work_kind, snapshot.available_ram_mb)
57
+ slot_count = _slot_count(work_kind, active_generic=active_generic)
58
+ return ResourceDecision(True, "normal", "capacity_available", slot_count, work_kind, snapshot.available_ram_mb)
59
+
60
+
61
+ def _slot_count(work_kind: str, *, active_generic: int) -> int:
62
+ if work_kind == "qwen":
63
+ return 1
64
+ if work_kind in {"codex", "grok", "claude", "security"}:
65
+ return 1
66
+ if work_kind in {"browser", "test"}:
67
+ return 2
68
+ return max(1, 4 - max(0, active_generic))
69
+
70
+
71
+ def _fallback_pressure(snapshot: ResourceSnapshot, requested_parallel: int) -> ResourceDecision:
72
+ ratio = snapshot.available_ram_mb / max(1, snapshot.total_ram_mb)
73
+ if ratio < 0.06 or (snapshot.cpu_percent > 97.0 and ratio < 0.10):
74
+ return ResourceDecision(False, "emergency_stop", "fallback_pressure_emergency", 0, "generic", snapshot.available_ram_mb)
75
+ if ratio < 0.10 or (snapshot.swap_used_mb > 0 and ratio < 0.15):
76
+ return ResourceDecision(False, "pause_new_agents", "fallback_pressure_pause", 0, "generic", snapshot.available_ram_mb)
77
+ if ratio < 0.15 or snapshot.swap_used_mb > 0:
78
+ return ResourceDecision(True, "sequential_only", "fallback_pressure_sequential", 1, "generic", snapshot.available_ram_mb)
79
+ return ResourceDecision(True, "normal", "fallback_pressure_normal", requested_parallel, "generic", snapshot.available_ram_mb)
80
+
81
+
82
+ __all__ = ["capacity_decision", "collect_resource_snapshot", "evaluate_pressure"]