hyperclaw 0.1.0a0__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 (129) hide show
  1. cli/__init__.py +1 -0
  2. cli/doctor.py +196 -0
  3. cli/hyperclaw.py +1028 -0
  4. cli/onboarding.py +248 -0
  5. core/__init__.py +1 -0
  6. core/connectors/__init__.py +119 -0
  7. core/connectors/infrastructure.py +772 -0
  8. core/connectors/messaging.py +586 -0
  9. core/connectors/productivity.py +764 -0
  10. core/connectors/smarthome.py +528 -0
  11. core/connectors/social.py +730 -0
  12. core/hyperrouter/__init__.py +23 -0
  13. core/hyperrouter/bandit.py +216 -0
  14. core/hyperrouter/fast_loop.py +68 -0
  15. core/hyperrouter/slow_loop.py +143 -0
  16. core/hyperstate/__init__.py +24 -0
  17. core/hyperstate/certifier.py +154 -0
  18. core/hyperstate/schema.py +160 -0
  19. core/hyperstate/state_manager.py +103 -0
  20. core/hyperstate/store.py +163 -0
  21. core/providers/__init__.py +121 -0
  22. core/providers/embeddings.py +353 -0
  23. core/providers/image.py +525 -0
  24. core/providers/llm.py +1929 -0
  25. core/providers/search.py +604 -0
  26. core/providers/voice.py +474 -0
  27. hyperclaw/__init__.py +21 -0
  28. hyperclaw/agent.py +739 -0
  29. hyperclaw/feeds.py +339 -0
  30. hyperclaw/integrations_layer.py +495 -0
  31. hyperclaw/prometheus.py +409 -0
  32. hyperclaw/scheduler.py +282 -0
  33. hyperclaw/skills.py +707 -0
  34. hyperclaw/solomon.py +362 -0
  35. hyperclaw/swarm.py +479 -0
  36. hyperclaw/telegram_bot.py +248 -0
  37. hyperclaw/trading/__init__.py +77 -0
  38. hyperclaw/tts.py +124 -0
  39. hyperclaw/tui.py +2770 -0
  40. hyperclaw-0.1.0a0.dist-info/METADATA +218 -0
  41. hyperclaw-0.1.0a0.dist-info/RECORD +129 -0
  42. hyperclaw-0.1.0a0.dist-info/WHEEL +5 -0
  43. hyperclaw-0.1.0a0.dist-info/entry_points.txt +3 -0
  44. hyperclaw-0.1.0a0.dist-info/licenses/LICENSE +21 -0
  45. hyperclaw-0.1.0a0.dist-info/top_level.txt +9 -0
  46. memory/__init__.py +1 -0
  47. memory/causal_graph.py +120 -0
  48. memory/impact_tracker.py +85 -0
  49. memory/vector_memory.py +323 -0
  50. models/__init__.py +12 -0
  51. models/chatjimmy_client.py +207 -0
  52. models/claude_client.py +106 -0
  53. models/claude_code_subagent.py +192 -0
  54. models/router.py +152 -0
  55. recursive/discovery_loop.py +115 -0
  56. recursive/optimization_loop.py +132 -0
  57. recursive/validation_loop.py +36 -0
  58. security/__init__.py +1 -0
  59. security/audit_logger.py +106 -0
  60. security/filesystem_guard.py +100 -0
  61. security/hypershield.py +99 -0
  62. security/network_guard.py +97 -0
  63. security/policy_engine.py +198 -0
  64. swarm/__init__.py +1 -0
  65. swarm/agents/__init__.py +0 -0
  66. swarm/agents/base.py +226 -0
  67. swarm/agents/business/__init__.py +0 -0
  68. swarm/agents/business/counsel.py +31 -0
  69. swarm/agents/business/herald.py +32 -0
  70. swarm/agents/business/ledger.py +26 -0
  71. swarm/agents/business/nexus.py +30 -0
  72. swarm/agents/business/ops.py +30 -0
  73. swarm/agents/business/pipeline.py +28 -0
  74. swarm/agents/business/revenue.py +31 -0
  75. swarm/agents/business/sovereign.py +31 -0
  76. swarm/agents/business/strategos.py +27 -0
  77. swarm/agents/business/talent.py +27 -0
  78. swarm/agents/business/venture.py +35 -0
  79. swarm/agents/comms/cipher.py +32 -0
  80. swarm/agents/comms/echo_comms.py +31 -0
  81. swarm/agents/comms/envoy.py +31 -0
  82. swarm/agents/comms/herald_scheduler.py +33 -0
  83. swarm/agents/comms/pulse.py +29 -0
  84. swarm/agents/creative/__init__.py +0 -0
  85. swarm/agents/creative/author.py +27 -0
  86. swarm/agents/creative/lens.py +25 -0
  87. swarm/agents/executive/__init__.py +1 -0
  88. swarm/agents/executive/genesis.py +30 -0
  89. swarm/agents/executive/gil.py +29 -0
  90. swarm/agents/executive/solomon.py +29 -0
  91. swarm/agents/intelligence/arbiter.py +30 -0
  92. swarm/agents/intelligence/prophet.py +31 -0
  93. swarm/agents/intelligence/sentinel.py +30 -0
  94. swarm/agents/media/__init__.py +0 -0
  95. swarm/agents/personal/__init__.py +0 -0
  96. swarm/agents/personal/atlas.py +27 -0
  97. swarm/agents/personal/hearth.py +26 -0
  98. swarm/agents/personal/midas.py +27 -0
  99. swarm/agents/personal/navigator.py +27 -0
  100. swarm/agents/personal/nourish.py +31 -0
  101. swarm/agents/personal/vitals.py +33 -0
  102. swarm/agents/recursive/__init__.py +0 -0
  103. swarm/agents/recursive/alchemist.py +73 -0
  104. swarm/agents/recursive/calibrator.py +45 -0
  105. swarm/agents/recursive/scout.py +97 -0
  106. swarm/agents/scientific/__init__.py +0 -0
  107. swarm/agents/scientific/cosmos.py +36 -0
  108. swarm/agents/scientific/gaia.py +26 -0
  109. swarm/agents/scientific/medicus.py +33 -0
  110. swarm/agents/scientific/oracle_agent.py +39 -0
  111. swarm/agents/scientific/scribe.py +39 -0
  112. swarm/agents/talent/__init__.py +0 -0
  113. swarm/agents/talent/deal.py +28 -0
  114. swarm/agents/talent/roster.py +29 -0
  115. swarm/agents/talent/scout.py +29 -0
  116. swarm/agents/talent/stage.py +27 -0
  117. swarm/agents/tech/__init__.py +0 -0
  118. swarm/agents/tech/aegis.py +28 -0
  119. swarm/agents/tech/bridge.py +28 -0
  120. swarm/agents/tech/forge.py +28 -0
  121. swarm/agents/trading/global_prediction_engine.py +611 -0
  122. swarm/agents/trading/polymarket_trader.py +169 -0
  123. swarm/agents/trading/prediction_strategist.py +218 -0
  124. swarm/autogen_bridge.py +68 -0
  125. swarm/bid_protocol.py +196 -0
  126. swarm/dispatcher.py +517 -0
  127. swarm/nexus.py +181 -0
  128. swarm/registry.py +188 -0
  129. ui/tui/app.py +213 -0
cli/__init__.py ADDED
@@ -0,0 +1 @@
1
+ # HyperClaw CLI
cli/doctor.py ADDED
@@ -0,0 +1,196 @@
1
+ """
2
+ hyperclaw doctor — system health check.
3
+ Verifies API keys, DB connection, pgvector, policy files, and dependencies.
4
+ """
5
+ from __future__ import annotations
6
+
7
+ import asyncio
8
+ import importlib
9
+ import os
10
+ import sys
11
+ from pathlib import Path
12
+ from typing import Callable
13
+
14
+ from rich.console import Console
15
+ from rich.table import Table
16
+ from rich import print as rprint
17
+
18
+ console = Console()
19
+
20
+ CHECK_MARK = "[bold green]✓[/bold green]"
21
+ CROSS_MARK = "[bold red]✗[/bold red]"
22
+ WARN_MARK = "[bold yellow]⚠[/bold yellow]"
23
+
24
+
25
+ def _check(label: str, ok: bool, detail: str = "", warn: bool = False) -> dict:
26
+ status = CHECK_MARK if ok else (WARN_MARK if warn else CROSS_MARK)
27
+ return {"label": label, "ok": ok, "warn": warn, "detail": detail, "status": status}
28
+
29
+
30
+ async def _check_db(db_url: str) -> dict:
31
+ try:
32
+ import asyncpg
33
+ conn = await asyncpg.connect(db_url, timeout=5)
34
+ await conn.close()
35
+ return _check("PostgreSQL connection", True, db_url.split("@")[-1] if "@" in db_url else db_url)
36
+ except Exception as e:
37
+ return _check("PostgreSQL connection", False, str(e)[:80])
38
+
39
+
40
+ async def _check_pgvector(db_url: str) -> dict:
41
+ try:
42
+ import asyncpg
43
+ conn = await asyncpg.connect(db_url, timeout=5)
44
+ row = await conn.fetchval(
45
+ "SELECT COUNT(*) FROM pg_extension WHERE extname = 'vector'"
46
+ )
47
+ await conn.close()
48
+ if row:
49
+ return _check("pgvector extension", True, "installed")
50
+ else:
51
+ return _check("pgvector extension", False,
52
+ "Not installed — run: CREATE EXTENSION vector; in your DB", warn=True)
53
+ except Exception as e:
54
+ return _check("pgvector extension", False, str(e)[:80])
55
+
56
+
57
+ async def _check_migrations(db_url: str) -> dict:
58
+ try:
59
+ import asyncpg
60
+ conn = await asyncpg.connect(db_url, timeout=5)
61
+ exists = await conn.fetchval(
62
+ "SELECT EXISTS(SELECT 1 FROM information_schema.tables WHERE table_name='_migrations')"
63
+ )
64
+ if exists:
65
+ applied = await conn.fetch("SELECT filename FROM _migrations ORDER BY filename")
66
+ names = [r["filename"] for r in applied]
67
+ await conn.close()
68
+ return _check("DB migrations", True, f"{len(names)} applied: {', '.join(names)}")
69
+ else:
70
+ await conn.close()
71
+ return _check("DB migrations", False,
72
+ "Not initialized — run: hyperclaw init", warn=True)
73
+ except Exception as e:
74
+ return _check("DB migrations", False, str(e)[:80])
75
+
76
+
77
+ def run_doctor() -> int:
78
+ """
79
+ Run all health checks and print results.
80
+ Returns 0 if all critical checks pass, 1 if any fail.
81
+ """
82
+ console.print("\n[bold cyan]⚡ HyperClaw Doctor[/bold cyan]\n")
83
+
84
+ checks: list[dict] = []
85
+ db_url = os.environ.get("DATABASE_URL", "")
86
+
87
+ # ── Python version ────────────────────────────────────────────────────────
88
+ py = sys.version_info
89
+ checks.append(_check(
90
+ "Python version",
91
+ py >= (3, 11),
92
+ f"{py.major}.{py.minor}.{py.micro}",
93
+ warn=(py >= (3, 11)),
94
+ ))
95
+
96
+ # ── Required packages ─────────────────────────────────────────────────────
97
+ required_packages = {
98
+ "pydantic": "pydantic",
99
+ "asyncpg": "asyncpg",
100
+ "anthropic": "anthropic",
101
+ "httpx": "httpx",
102
+ "typer": "typer",
103
+ "rich": "rich",
104
+ "yaml": "yaml (pyyaml)",
105
+ "dotenv": "dotenv (python-dotenv)",
106
+ }
107
+ for mod, label in required_packages.items():
108
+ try:
109
+ importlib.import_module(mod)
110
+ checks.append(_check(f"Package: {label}", True))
111
+ except ImportError:
112
+ checks.append(_check(f"Package: {label}", False, f"pip install {label.split()[0]}"))
113
+
114
+ # ── Environment variables ─────────────────────────────────────────────────
115
+ anthropic_key = os.environ.get("ANTHROPIC_API_KEY", "")
116
+ checks.append(_check(
117
+ "ANTHROPIC_API_KEY",
118
+ bool(anthropic_key),
119
+ f"sk-ant-...{anthropic_key[-6:]}" if anthropic_key else "Not set — export ANTHROPIC_API_KEY=...",
120
+ ))
121
+
122
+ db_url_env = os.environ.get("DATABASE_URL", "")
123
+ checks.append(_check(
124
+ "DATABASE_URL",
125
+ bool(db_url_env),
126
+ f"...{db_url_env[-30:]}" if db_url_env else "Not set — using config/hyperclaw.yaml fallback",
127
+ warn=not bool(db_url_env),
128
+ ))
129
+
130
+ chatjimmy_key = os.environ.get("CHATJIMMY_API_KEY", "")
131
+ checks.append(_check(
132
+ "CHATJIMMY_API_KEY",
133
+ bool(chatjimmy_key),
134
+ "Set" if chatjimmy_key else "Not set — ChatJimmy will be unavailable (optional)",
135
+ warn=not bool(chatjimmy_key),
136
+ ))
137
+
138
+ # ── Config files ──────────────────────────────────────────────────────────
139
+ config_files = [
140
+ "config/hyperclaw.yaml",
141
+ "config/agents.yaml",
142
+ "config/models.yaml",
143
+ "security/policies/default.yaml",
144
+ ]
145
+ for cf in config_files:
146
+ checks.append(_check(f"Config: {cf}", Path(cf).exists(),
147
+ "Found" if Path(cf).exists() else f"Missing — run: hyperclaw init"))
148
+
149
+ # ── DB checks (async) ─────────────────────────────────────────────────────
150
+ if db_url_env:
151
+ loop = asyncio.new_event_loop()
152
+ try:
153
+ checks.append(loop.run_until_complete(_check_db(db_url_env)))
154
+ checks.append(loop.run_until_complete(_check_pgvector(db_url_env)))
155
+ checks.append(loop.run_until_complete(_check_migrations(db_url_env)))
156
+ finally:
157
+ loop.close()
158
+ else:
159
+ checks.append(_check("PostgreSQL connection", False,
160
+ "Skipped — DATABASE_URL not set", warn=True))
161
+ checks.append(_check("pgvector extension", False,
162
+ "Skipped — DATABASE_URL not set", warn=True))
163
+ checks.append(_check("DB migrations", False,
164
+ "Skipped — DATABASE_URL not set", warn=True))
165
+
166
+ # ── Print results ─────────────────────────────────────────────────────────
167
+ table = Table(show_header=True, header_style="bold cyan", expand=True)
168
+ table.add_column("Check", style="bold")
169
+ table.add_column("Status", justify="center", width=4)
170
+ table.add_column("Detail", style="dim")
171
+
172
+ for c in checks:
173
+ table.add_row(c["label"], c["status"], c["detail"])
174
+
175
+ console.print(table)
176
+
177
+ failed = [c for c in checks if not c["ok"] and not c.get("warn")]
178
+ warned = [c for c in checks if not c["ok"] and c.get("warn")]
179
+ passed = [c for c in checks if c["ok"]]
180
+
181
+ console.print(
182
+ f"\n[green]{len(passed)} passed[/green] "
183
+ f"[yellow]{len(warned)} warnings[/yellow] "
184
+ f"[red]{len(failed)} failed[/red]"
185
+ )
186
+
187
+ if failed:
188
+ console.print("\n[red]Fix the failed checks above before running hyperclaw start.[/red]")
189
+ return 1
190
+
191
+ if not warned:
192
+ console.print("\n[bold green]✓ HyperClaw is healthy and ready to run.[/bold green]")
193
+ else:
194
+ console.print("\n[bold yellow]⚠ HyperClaw has warnings — review above before running tasks.[/bold yellow]")
195
+
196
+ return 0