hypermind 0.11.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 (181) hide show
  1. hmctl/__init__.py +7 -0
  2. hmctl/cli.py +947 -0
  3. hypermind/__init__.py +208 -0
  4. hypermind/_deprecations.py +108 -0
  5. hypermind/agent.py +2896 -0
  6. hypermind/agent_card.py +127 -0
  7. hypermind/api/__init__.py +32 -0
  8. hypermind/api/app.py +686 -0
  9. hypermind/capability.py +923 -0
  10. hypermind/consult.py +493 -0
  11. hypermind/consult_bias.py +112 -0
  12. hypermind/contract_net.py +219 -0
  13. hypermind/crypto/__init__.py +21 -0
  14. hypermind/crypto/cose_encrypt.py +126 -0
  15. hypermind/crypto/dkg.py +246 -0
  16. hypermind/crypto/domain.py +59 -0
  17. hypermind/crypto/frost.py +771 -0
  18. hypermind/crypto/hashing.py +38 -0
  19. hypermind/crypto/hlc.py +163 -0
  20. hypermind/crypto/hpke.py +277 -0
  21. hypermind/crypto/kms.py +196 -0
  22. hypermind/crypto/kms_backends/__init__.py +56 -0
  23. hypermind/crypto/kms_backends/aws.py +128 -0
  24. hypermind/crypto/kms_backends/azure.py +114 -0
  25. hypermind/crypto/kms_backends/gcp.py +97 -0
  26. hypermind/crypto/kms_backends/vault.py +120 -0
  27. hypermind/crypto/namespace_root.py +204 -0
  28. hypermind/crypto/pq.py +152 -0
  29. hypermind/crypto/room_epoch.py +97 -0
  30. hypermind/crypto/signing.py +245 -0
  31. hypermind/deliberation.py +355 -0
  32. hypermind/did_web.py +256 -0
  33. hypermind/dispute.py +858 -0
  34. hypermind/errors.py +218 -0
  35. hypermind/eval/__init__.py +49 -0
  36. hypermind/eval/calibration.py +307 -0
  37. hypermind/eval/comparison.py +251 -0
  38. hypermind/eval/replay.py +202 -0
  39. hypermind/eval/swarm_iq.py +718 -0
  40. hypermind/knowledge/__init__.py +17 -0
  41. hypermind/knowledge/citation_graph.py +141 -0
  42. hypermind/knowledge/correlated_agreement.py +167 -0
  43. hypermind/knowledge/embedding_registry.py +115 -0
  44. hypermind/knowledge/kernel_store.py +197 -0
  45. hypermind/knowledge/rekor.py +173 -0
  46. hypermind/knowledge/reputation.py +364 -0
  47. hypermind/knowledge/swarm_memory.py +523 -0
  48. hypermind/knowledge/transparency.py +409 -0
  49. hypermind/mcp/__init__.py +60 -0
  50. hypermind/mcp/bridge.py +151 -0
  51. hypermind/mcp/client.py +142 -0
  52. hypermind/mcp/provenance.py +214 -0
  53. hypermind/mcp/relata_tools.py +152 -0
  54. hypermind/mcp/server.py +248 -0
  55. hypermind/mcp/transport.py +206 -0
  56. hypermind/mind/__init__.py +150 -0
  57. hypermind/mind/active.py +234 -0
  58. hypermind/mind/belief.py +369 -0
  59. hypermind/mind/deliberator.py +625 -0
  60. hypermind/mind/diversity.py +144 -0
  61. hypermind/mind/evolve.py +184 -0
  62. hypermind/mind/federation.py +154 -0
  63. hypermind/mind/goals.py +117 -0
  64. hypermind/mind/integration.py +190 -0
  65. hypermind/mind/mediator.py +74 -0
  66. hypermind/mind/memory_store.py +129 -0
  67. hypermind/mind/policy.py +307 -0
  68. hypermind/mind/records.py +260 -0
  69. hypermind/mind/roles.py +190 -0
  70. hypermind/mind/sybil_guard.py +41 -0
  71. hypermind/mind/world_model.py +166 -0
  72. hypermind/namespace.py +515 -0
  73. hypermind/namespace_policy.py +254 -0
  74. hypermind/observability/__init__.py +25 -0
  75. hypermind/observability/asgi.py +214 -0
  76. hypermind/observability/cost.py +277 -0
  77. hypermind/observability/otel_export.py +200 -0
  78. hypermind/observability/recorder.py +344 -0
  79. hypermind/observability/swarm_trace.py +438 -0
  80. hypermind/pin_policy.py +116 -0
  81. hypermind/py.typed +0 -0
  82. hypermind/responders/__init__.py +87 -0
  83. hypermind/responders/anthropic.py +159 -0
  84. hypermind/responders/base.py +162 -0
  85. hypermind/responders/openai.py +199 -0
  86. hypermind/responders/router.py +254 -0
  87. hypermind/responders/structured.py +287 -0
  88. hypermind/responders/tools.py +444 -0
  89. hypermind/revocation.py +270 -0
  90. hypermind/rule_ids.py +135 -0
  91. hypermind/schemas/encrypted_statement.cddl +28 -0
  92. hypermind/schemas/namespace_accept.cddl +20 -0
  93. hypermind/schemas/namespace_create.cddl +25 -0
  94. hypermind/schemas/namespace_founding_attest.cddl +30 -0
  95. hypermind/schemas/namespace_invite.cddl +22 -0
  96. hypermind/schemas/wire-v0.1.cddl +73 -0
  97. hypermind/simlab/__init__.py +15 -0
  98. hypermind/simlab/_persona_registry.py +93 -0
  99. hypermind/simlab/_scenario_impl.py +2778 -0
  100. hypermind/simlab/app.py +2538 -0
  101. hypermind/simlab/backends/__init__.py +27 -0
  102. hypermind/simlab/backends/anchor.py +88 -0
  103. hypermind/simlab/backends/local.py +32 -0
  104. hypermind/simlab/backends/server.py +79 -0
  105. hypermind/simlab/cli_command.py +108 -0
  106. hypermind/simlab/config.py +106 -0
  107. hypermind/simlab/deployment.py +26 -0
  108. hypermind/simlab/knowledge.py +716 -0
  109. hypermind/simlab/learning.py +295 -0
  110. hypermind/simlab/modes/__init__.py +115 -0
  111. hypermind/simlab/modes/_eval_real_llm.py +373 -0
  112. hypermind/simlab/modes/aar.py +611 -0
  113. hypermind/simlab/modes/backtest.py +610 -0
  114. hypermind/simlab/modes/binary_forecast.py +69 -0
  115. hypermind/simlab/modes/conformance.py +1869 -0
  116. hypermind/simlab/modes/evaluation.py +2271 -0
  117. hypermind/simlab/modes/governance.py +648 -0
  118. hypermind/simlab/modes/redteam.py +534 -0
  119. hypermind/simlab/modes/tabletop.py +797 -0
  120. hypermind/simlab/modes/tournament.py +448 -0
  121. hypermind/simlab/modes/whatif.py +523 -0
  122. hypermind/simlab/namespace.py +125 -0
  123. hypermind/simlab/personas.py +477 -0
  124. hypermind/simlab/prompt_generator.py +172 -0
  125. hypermind/simlab/question_sets/geopolitics_q20.json +122 -0
  126. hypermind/simlab/question_sets/governance_q5.json +67 -0
  127. hypermind/simlab/question_sets/msft_outlook_q10.json +62 -0
  128. hypermind/simlab/question_sets/whatif_q3.json +38 -0
  129. hypermind/simlab/registry.py +325 -0
  130. hypermind/simlab/runner.py +239 -0
  131. hypermind/simlab/scenario.py +147 -0
  132. hypermind/simlab/swarms.py +180 -0
  133. hypermind/simlab/tool_handlers/__init__.py +4 -0
  134. hypermind/simlab/tool_handlers/alpha_vantage.py +39 -0
  135. hypermind/simlab/tool_handlers/brave.py +46 -0
  136. hypermind/simlab/tool_handlers/newsapi.py +50 -0
  137. hypermind/simlab/tool_handlers/openweather.py +46 -0
  138. hypermind/simlab/tool_handlers/pinecone.py +52 -0
  139. hypermind/simlab/tool_handlers/qdrant.py +57 -0
  140. hypermind/simlab/tool_handlers/query_knowledge_base.py +21 -0
  141. hypermind/simlab/tool_handlers/relata_recall.py +61 -0
  142. hypermind/simlab/tool_handlers/retrieve_document.py +21 -0
  143. hypermind/simlab/tool_handlers/serper.py +46 -0
  144. hypermind/simlab/tool_handlers/tavily.py +53 -0
  145. hypermind/simlab/tool_handlers/weaviate.py +65 -0
  146. hypermind/simlab/tool_handlers/wikipedia.py +64 -0
  147. hypermind/simlab/tool_handlers/wolfram.py +48 -0
  148. hypermind/simlab/tool_handlers/yahoo_finance.py +49 -0
  149. hypermind/simlab/tool_registry.py +568 -0
  150. hypermind/simlab/topic_adapter.py +338 -0
  151. hypermind/simlab/topic_questions.py +259 -0
  152. hypermind/storage/__init__.py +69 -0
  153. hypermind/storage/backend.py +71 -0
  154. hypermind/storage/relata.py +245 -0
  155. hypermind/storage/sqlite.py +258 -0
  156. hypermind/sync.py +191 -0
  157. hypermind/tal.py +175 -0
  158. hypermind/tasks.py +334 -0
  159. hypermind/testing.py +16 -0
  160. hypermind/tools/__init__.py +32 -0
  161. hypermind/tools/registry.py +61 -0
  162. hypermind/transport/__init__.py +22 -0
  163. hypermind/transport/anti_entropy.py +708 -0
  164. hypermind/transport/bus.py +206 -0
  165. hypermind/transport/knows_delta.py +204 -0
  166. hypermind/transport/libp2p.py +298 -0
  167. hypermind/transport/placement.py +58 -0
  168. hypermind/transport/tcp.py +797 -0
  169. hypermind/transport/tls_profile.py +417 -0
  170. hypermind/types.py +59 -0
  171. hypermind/uncertainty.py +222 -0
  172. hypermind/wire.py +897 -0
  173. hypermind/workflow/__init__.py +72 -0
  174. hypermind/workflow/engine.py +655 -0
  175. hypermind/workflow/plan.py +182 -0
  176. hypermind/workflow/repair.py +203 -0
  177. hypermind-0.11.0.dist-info/METADATA +524 -0
  178. hypermind-0.11.0.dist-info/RECORD +181 -0
  179. hypermind-0.11.0.dist-info/WHEEL +4 -0
  180. hypermind-0.11.0.dist-info/entry_points.txt +2 -0
  181. hypermind-0.11.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,127 @@
1
+ """AgentCard — signed self-description for agent discovery (spec §3.2).
2
+
3
+ An AgentCard is published by an agent as a regular sealed claim (claim_type
4
+ "agent_card") so peers can discover its capabilities, supported topics, roles,
5
+ and contact endpoint. It rides in the standard SEAL SignedStatement envelope
6
+ and is stored in the shared transparency log like any other claim.
7
+
8
+ Spec reference: draft-hypermind-scitt-contested-claims-profile-00 §3.2 and
9
+ the A2A bridge normative requirement at §4.12.1.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ from dataclasses import dataclass, field
15
+ from typing import Any
16
+
17
+ __all__ = ["AgentCard"]
18
+
19
+
20
+ @dataclass
21
+ class AgentCard:
22
+ """Signed self-description published by an agent for peer discovery.
23
+
24
+ Fields mirror spec §3.2. All fields are optional except ``agent_kid``,
25
+ which is the 32-byte Ed25519 public-key half used as the stable agent
26
+ address.
27
+
28
+ Serialisation contract
29
+ ----------------------
30
+ ``to_payload()`` / ``from_payload()`` are the only public serialisation
31
+ primitives; they produce/consume a plain ``dict`` that the standard
32
+ ``publish_claim`` payload pipeline can embed directly. The ``agent_kid``
33
+ is encoded as a lowercase hex string so the JSON/CBOR payload layer
34
+ does not need to handle raw bytes.
35
+
36
+ Usage::
37
+
38
+ card = AgentCard(
39
+ agent_kid=agent.keypair.kid,
40
+ display_name="Alice the Scout",
41
+ topics=["ai-safety-evals", "threat-intel"],
42
+ roles=["Scout"],
43
+ sdk_version="0.10.0",
44
+ )
45
+ kid = await agent.publish_card(card)
46
+ """
47
+
48
+ agent_kid: bytes
49
+ """32-byte Ed25519 public-key half; the stable agent address."""
50
+
51
+ display_name: str = ""
52
+ """Human-readable name shown in dashboards and dispute panels."""
53
+
54
+ topics: list[str] = field(default_factory=list)
55
+ """Topic strings this agent is willing to engage on."""
56
+
57
+ roles: list[str] = field(default_factory=list)
58
+ """Role bundle names (Scout, Sceptic, Generalist, Synthesist, Mediator, Oracle)."""
59
+
60
+ capabilities: list[str] = field(default_factory=list)
61
+ """Advertised CapToken caveat kinds (e.g. "topic", "rate", "expiry")."""
62
+
63
+ endpoint: str = ""
64
+ """Optional contact endpoint URI (A2A / MCP server URL; see §4.12)."""
65
+
66
+ sdk_version: str = ""
67
+ """SDK version string, e.g. "0.10.0"."""
68
+
69
+ metadata: dict[str, Any] = field(default_factory=dict)
70
+ """Arbitrary extra fields; preserved round-trip but not interpreted."""
71
+
72
+ # ------------------------------------------------------------------
73
+ # Serialisation helpers
74
+ # ------------------------------------------------------------------
75
+
76
+ def to_payload(self) -> dict[str, Any]:
77
+ """Serialise to a JSON-serialisable dict for embedding in a claim payload.
78
+
79
+ ``agent_kid`` is hex-encoded so the payload is safe for JSON and
80
+ deterministic CBOR transport layers.
81
+ """
82
+ if len(self.agent_kid) != 32:
83
+ raise ValueError(
84
+ f"agent_kid must be exactly 32 bytes; got {len(self.agent_kid)}"
85
+ )
86
+ return {
87
+ "agent_kid": self.agent_kid.hex(),
88
+ "display_name": self.display_name,
89
+ "topics": list(self.topics),
90
+ "roles": list(self.roles),
91
+ "capabilities": list(self.capabilities),
92
+ "endpoint": self.endpoint,
93
+ "sdk_version": self.sdk_version,
94
+ "metadata": dict(self.metadata),
95
+ }
96
+
97
+ @classmethod
98
+ def from_payload(cls, payload: dict[str, Any]) -> AgentCard:
99
+ """Deserialise from a claim payload dict produced by ``to_payload()``.
100
+
101
+ Raises ``ValueError`` if the required ``agent_kid`` field is missing or
102
+ the hex string does not decode to exactly 32 bytes.
103
+ """
104
+ if "agent_kid" not in payload:
105
+ raise ValueError("AgentCard payload missing required field 'agent_kid'")
106
+ agent_kid = bytes.fromhex(payload["agent_kid"])
107
+ if len(agent_kid) != 32:
108
+ raise ValueError(
109
+ f"agent_kid must decode to 32 bytes; got {len(agent_kid)}"
110
+ )
111
+ return cls(
112
+ agent_kid=agent_kid,
113
+ display_name=payload.get("display_name", ""),
114
+ topics=list(payload.get("topics", [])),
115
+ roles=list(payload.get("roles", [])),
116
+ capabilities=list(payload.get("capabilities", [])),
117
+ endpoint=payload.get("endpoint", ""),
118
+ sdk_version=payload.get("sdk_version", ""),
119
+ metadata=dict(payload.get("metadata", {})),
120
+ )
121
+
122
+ def __repr__(self) -> str:
123
+ return (
124
+ f"AgentCard(kid={self.agent_kid.hex()[:12]}... "
125
+ f"name={self.display_name!r} "
126
+ f"topics={self.topics!r})"
127
+ )
@@ -0,0 +1,32 @@
1
+ """HTTP management API for a HyperMindAgent.
2
+
3
+ Wraps a single agent in an ASGI 3 app so non-Python callers can:
4
+
5
+ * publish claims (POST /v1/claims)
6
+ * query a claim by kid (GET /v1/claims/{kid})
7
+ * stream the audit log (GET /v1/audit)
8
+ * read reputation (GET /v1/reputation/{agent_kid}?topic=...)
9
+ * list disputes (GET /v1/disputes)
10
+ * run a panel consult (POST /v1/consult)
11
+ * read agent introspection (GET /v1/introspect)
12
+ * read storage / health stats (GET /v1/stats, /healthz)
13
+ * scrape Prometheus metrics (GET /metrics)
14
+
15
+ Zero hard dependencies — pure ASGI 3, JSON only, runs under any ASGI
16
+ server (uvicorn, hypercorn, daphne).
17
+
18
+ Mount under uvicorn::
19
+
20
+ from hypermind import HyperMindAgent
21
+ from hypermind.api import management_app
22
+
23
+ agent = HyperMindAgent.sandbox(room="prod")
24
+ app = management_app(agent)
25
+ # uvicorn.run(app, host="0.0.0.0", port=8080)
26
+ """
27
+
28
+ from __future__ import annotations
29
+
30
+ from hypermind.api.app import management_app
31
+
32
+ __all__ = ["management_app"]